[gnome-battery-bench] GbbPowerState: remove capacity field
- From: Christian Kellner <gicmo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-battery-bench] GbbPowerState: remove capacity field
- Date: Wed, 3 May 2017 11:47:31 +0000 (UTC)
commit 55b7a30e3a16b248f87c7147d8f2078271fb22df
Author: Christian Kellner <gicmo gnome org>
Date: Wed May 3 13:33:05 2017 +0200
GbbPowerState: remove capacity field
We are not reading it anymore anyway; everything is based on energy.
src/power-monitor.c | 12 +-----------
src/power-monitor.h | 1 -
src/test-run.c | 6 ------
3 files changed, 1 insertions(+), 18 deletions(-)
---
diff --git a/src/power-monitor.c b/src/power-monitor.c
index 288ca9a..016fc06 100644
--- a/src/power-monitor.c
+++ b/src/power-monitor.c
@@ -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;
diff --git a/src/power-monitor.h b/src/power-monitor.h
index cb4b205..29666fb 100644
--- a/src/power-monitor.h
+++ b/src/power-monitor.h
@@ -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;
};
diff --git a/src/test-run.c b/src/test-run.c
index a2eed1c..a901fef 100644
--- a/src/test-run.c
+++ b/src/test-run.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]