OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import time | 5 import time |
6 | 6 |
7 from metrics import Metric | |
8 from telemetry.core.platform import process_statistic_timeline_data | 7 from telemetry.core.platform import process_statistic_timeline_data |
9 from telemetry.value import scalar | 8 from telemetry.value import scalar |
10 | 9 |
| 10 from metrics import Metric |
| 11 |
11 | 12 |
12 class PowerMetric(Metric): | 13 class PowerMetric(Metric): |
13 """A metric for measuring power usage.""" | 14 """A metric for measuring power usage.""" |
14 | 15 |
15 # System power draw while idle. | 16 # System power draw while idle. |
16 _quiescent_power_draw_mwh = 0 | 17 _quiescent_power_draw_mwh = 0 |
17 | 18 |
18 def __init__(self, platform, quiescent_measurement_time_s=0): | 19 def __init__(self, platform, quiescent_measurement_time_s=0): |
19 """PowerMetric Constructor. | 20 """PowerMetric Constructor. |
20 | 21 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 continue | 187 continue |
187 | 188 |
188 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], | 189 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], |
189 process_statistic_timeline_data.IdleWakeupTimelineData) | 190 process_statistic_timeline_data.IdleWakeupTimelineData) |
190 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - | 191 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - |
191 start_cpu_stats[process_type]['IdleWakeupCount']) | 192 start_cpu_stats[process_type]['IdleWakeupCount']) |
192 cpu_delta[process_type] = idle_wakeup_delta.total_sum() | 193 cpu_delta[process_type] = idle_wakeup_delta.total_sum() |
193 total = total + cpu_delta[process_type] | 194 total = total + cpu_delta[process_type] |
194 cpu_delta['Total'] = total | 195 cpu_delta['Total'] = total |
195 return cpu_delta | 196 return cpu_delta |
OLD | NEW |