1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 from telemetry
.core
import exceptions
10 class PowerMonitor(object):
13 Provides an interface to register power consumption during a test.
16 self
._monitoring
= False
18 def CanMonitorPower(self
):
19 """Returns True iff power can be monitored asynchronously via
20 StartMonitoringPower() and StopMonitoringPower().
24 def CanMeasurePerApplicationPower(self
):
25 """Returns True if the power monitor can measure power for the target
26 application in isolation. False if power measurement is for full system
27 energy consumption."""
30 def _CheckStart(self
):
31 assert not self
._monitoring
, "Already monitoring power."
32 self
._monitoring
= True
35 assert self
._monitoring
, "Not monitoring power."
36 self
._monitoring
= False
38 def StartMonitoringPower(self
, browser
):
39 """Starts monitoring power utilization statistics.
41 See Platform#StartMonitoringPower for the arguments format.
43 raise NotImplementedError()
45 def StopMonitoringPower(self
):
46 """Stops monitoring power utilization and returns collects stats
48 See Platform#StopMonitoringPower for the return format.
50 raise NotImplementedError()