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

Unified Diff: tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py

Issue 1432093002: Improve readability of power monitoring code and add additional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix issue 556653 Created 5 years, 1 month 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 | tools/telemetry/telemetry/internal/platform/power_monitor/android_dumpsys_power_monitor.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py
diff --git a/tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py b/tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py
index 7a13fa91d2b2de33e6024e89547bafc3ba7c6e15..4c3cf4532cbe3859ba6d966d185a45b76ef7d041 100644
--- a/tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py
+++ b/tools/telemetry/telemetry/internal/platform/power_monitor/__init__.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
+
from telemetry.core import exceptions
@@ -10,6 +12,9 @@ class PowerMonitor(object):
Provides an interface to register power consumption during a test.
"""
+ def __init__(self):
+ self._monitoring = False
+
def CanMonitorPower(self):
"""Returns True iff power can be monitored asynchronously via
StartMonitoringPower() and StopMonitoringPower().
@@ -22,6 +27,14 @@ class PowerMonitor(object):
energy consumption."""
return False
+ def _CheckStart(self):
+ assert not self._monitoring, "Already monitoring power."
+ self._monitoring = True
+
+ def _CheckStop(self):
+ assert self._monitoring, "Not monitoring power."
+ self._monitoring = False
+
def StartMonitoringPower(self, browser):
"""Starts monitoring power utilization statistics.
« no previous file with comments | « no previous file | tools/telemetry/telemetry/internal/platform/power_monitor/android_dumpsys_power_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698