[gnome-battery-bench] Stop updating average statistics when the run is stopped



commit 85e732dbda29ff53dfc78bde9a1a1af6208233e6
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Jan 19 11:49:56 2015 -0500

    Stop updating average statistics when the run is stopped
    
    Once the run is stopped or finished, the statistics displayed on
    the Test page should be the statistics for the run not the
    statistics accumulated since the start of the run.

 src/application.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index 0256c2b..160bcac 100644
--- a/src/application.c
+++ b/src/application.c
@@ -167,8 +167,15 @@ update_labels(GbbApplication *application)
     GbbPowerStatistics *overall_statistics = NULL;
     if (application->run) {
         const GbbPowerState *start_state = gbb_test_run_get_start_state(application->run);
-        if (start_state)
-            overall_statistics = gbb_power_statistics_compute(start_state, current_state);
+        if (start_state) {
+            const GbbPowerState *end_state;
+            if (gbb_test_runner_get_phase(application->runner) == GBB_TEST_PHASE_RUNNING)
+                end_state = current_state;
+            else
+                end_state = gbb_test_run_get_last_state(application->run);
+
+            overall_statistics = gbb_power_statistics_compute(start_state, end_state);
+        }
     }
 
     if (overall_statistics && overall_statistics->power >= 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]