Commit 55b7a30e authored by Christian Kellner's avatar Christian Kellner
Browse files

GbbPowerState: remove capacity field

We are not reading it anymore anyway; everything is based on energy.
parent 95f20dd3
......@@ -40,12 +40,7 @@ gbb_power_state_free(GbbPowerState *state)
double
gbb_power_state_get_percent (const GbbPowerState *state)
{
if (state->energy_full >= 0)
return 100 * state->energy_now / state->energy_full;
else if (state->capacity_now >= 0)
return 100 * state->capacity_now;
else
return -1;
return 100 * state->energy_now / state->energy_full;
}
static gboolean
......@@ -148,7 +143,6 @@ gbb_power_state_init(GbbPowerState *state)
state->energy_now = -1.0;
state->energy_full = -1.0;
state->energy_full_design = -1.0;
state->capacity_now = -1.0;
state->voltage_now = -1.0;
}
......@@ -269,10 +263,6 @@ gbb_power_statistics_compute (const GbbPowerState *base,
if (base->energy_full_design >= 0)
statistics->battery_life_design = 3600 * base->energy_full_design / statistics->power;
}
} else if (current->capacity_now >= 0 && time_elapsed > 0) {
double capacity_used = base->capacity_now - current->capacity_now;
if (capacity_used > 0)
statistics->battery_life = 3600 * time_elapsed / capacity_used;
}
return statistics;
......
......@@ -21,7 +21,6 @@ struct _GbbPowerState {
double energy_now; /* WH */
double energy_full;
double energy_full_design;
double capacity_now; /* 0 - 1.0 */
double voltage_now;
};
......
......@@ -401,10 +401,6 @@ gbb_test_run_write_to_file(GbbTestRun *run,
json_builder_set_member_name(builder, "energy-full-design");
add_int_value_1e6(builder, state->energy_full_design);
}
if (state->capacity_now >= 0) {
json_builder_set_member_name(builder, "capacity");
add_int_value_1e6(builder, state->capacity_now);
}
json_builder_end_object(builder);
last_state = state;
......@@ -724,8 +720,6 @@ read_from_file(GbbTestRun *run,
goto out;
if (get_int_1e6(node_object, "energy-full-design", &state->energy_full_design, error) == ERROR)
goto out;
if (get_int_1e6(node_object, "capacity", &state->capacity_now, error) == ERROR)
goto out;
test_run_add_internal(run, state);
last_state = state;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment