### Assume energy_now while computing statistics

```Therefore we can simplify the code. The minimal interval we need
to wait to see any changes is UPDATE_FREQUENCY.```
parent 55b7a30e
 ... @@ -254,15 +254,17 @@ gbb_power_statistics_compute (const GbbPowerState *base, ... @@ -254,15 +254,17 @@ gbb_power_statistics_compute (const GbbPowerState *base, double time_elapsed = (current->time_us - base->time_us) / 1000000.; double time_elapsed = (current->time_us - base->time_us) / 1000000.; if (current->energy_now >= 0 && time_elapsed > 0) { if (time_elapsed < (UPDATE_FREQUENCY / 1000.)) { double energy_used = base->energy_now - current->energy_now; return statistics; if (energy_used > 0) { } statistics->power = 3600 * (energy_used) / time_elapsed; if (base->energy_full >= 0) double energy_used = base->energy_now - current->energy_now; statistics->battery_life = 3600 * base->energy_full / statistics->power; if (energy_used > 0) { if (base->energy_full_design >= 0) statistics->power = 3600 * (energy_used) / time_elapsed; statistics->battery_life_design = 3600 * base->energy_full_design / statistics->power; if (base->energy_full >= 0) } statistics->battery_life = 3600 * base->energy_full / statistics->power; if (base->energy_full_design >= 0) statistics->battery_life_design = 3600 * base->energy_full_design / statistics->power; } } return statistics; return statistics; ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!