Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Unified Diff: tools/perf/metrics/power.py

Issue 371383002: [Telemetry] Measure quiescent power once per run in power metric (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/power.py
diff --git a/tools/perf/metrics/power.py b/tools/perf/metrics/power.py
index d6ed32787639db83674e3316f571392340331854..022c02fbce1708c298794595a4de888dda4f0786 100644
--- a/tools/perf/metrics/power.py
+++ b/tools/perf/metrics/power.py
@@ -11,6 +11,9 @@ from telemetry.value import scalar
class PowerMetric(Metric):
"""A metric for measuring power usage."""
+ # System power draw while idle.
+ _quiescent_power_draw_mwh = 0
Dominik Grewe 2014/07/08 13:05:19 Would it make sense to set this to 'None' here to
+
def __init__(self, browser, quiescent_measurement_time_s=0):
"""PowerMetric Constructor.
@@ -23,7 +26,6 @@ class PowerMetric(Metric):
self._running = False
self._starting_cpu_stats = None
self._results = None
- self._quiescent_power_draw_mwh = 0
self._MeasureQuiescentPower(quiescent_measurement_time_s)
def __del__(self):
@@ -53,10 +55,14 @@ class PowerMetric(Metric):
not measurement_time_s:
return
+ # Only perform quiescent measurement once per run.
+ if PowerMetric._quiescent_power_draw_mwh:
Dominik Grewe 2014/07/08 13:05:19 I think I'd do this check in __init__ but that's j
+ return
+
platform.StartMonitoringPower(self._browser)
time.sleep(measurement_time_s)
power_results = platform.StopMonitoringPower()
- self._quiescent_power_draw_mwh = (
+ PowerMetric._quiescent_power_draw_mwh = (
power_results.get('energy_consumption_mwh', 0))
def Start(self, _, tab):
@@ -95,7 +101,8 @@ class PowerMetric(Metric):
if not application_energy_consumption_mwh and total_energy_consumption_mwh:
application_energy_consumption_mwh = max(
- total_energy_consumption_mwh - self._quiescent_power_draw_mwh, 0)
+ total_energy_consumption_mwh - PowerMetric._quiescent_power_draw_mwh,
+ 0)
if total_energy_consumption_mwh is not None:
results.AddValue(scalar.ScalarValue(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698