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 | 7 from metrics import Metric |
8 from telemetry.core.platform import process_statistic_timeline_data | 8 from telemetry.core.platform import process_statistic_timeline_data |
9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 metrics here which is why there are plenty of checks for 'is not None' | 95 metrics here which is why there are plenty of checks for 'is not None' |
96 below. | 96 below. |
97 """ | 97 """ |
98 if not self._results: | 98 if not self._results: |
99 return | 99 return |
100 | 100 |
101 application_energy_consumption_mwh = ( | 101 application_energy_consumption_mwh = ( |
102 self._results.get('application_energy_consumption_mwh')) | 102 self._results.get('application_energy_consumption_mwh')) |
103 total_energy_consumption_mwh = self._results.get('energy_consumption_mwh') | 103 total_energy_consumption_mwh = self._results.get('energy_consumption_mwh') |
104 | 104 |
105 if not application_energy_consumption_mwh and total_energy_consumption_mwh: | 105 if (PowerMetric._quiescent_power_draw_mwh and |
| 106 application_energy_consumption_mwh is None and |
| 107 total_energy_consumption_mwh is not None): |
106 application_energy_consumption_mwh = max( | 108 application_energy_consumption_mwh = max( |
107 total_energy_consumption_mwh - PowerMetric._quiescent_power_draw_mwh, | 109 total_energy_consumption_mwh - PowerMetric._quiescent_power_draw_mwh, |
108 0) | 110 0) |
109 | 111 |
110 if total_energy_consumption_mwh is not None: | 112 if total_energy_consumption_mwh is not None: |
111 results.AddValue(scalar.ScalarValue( | 113 results.AddValue(scalar.ScalarValue( |
112 results.current_page, 'energy_consumption_mwh', 'mWh', | 114 results.current_page, 'energy_consumption_mwh', 'mWh', |
113 total_energy_consumption_mwh)) | 115 total_energy_consumption_mwh)) |
114 | 116 |
115 if application_energy_consumption_mwh is not None: | 117 if application_energy_consumption_mwh is not None: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 continue | 186 continue |
185 | 187 |
186 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], | 188 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], |
187 process_statistic_timeline_data.IdleWakeupTimelineData) | 189 process_statistic_timeline_data.IdleWakeupTimelineData) |
188 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - | 190 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - |
189 start_cpu_stats[process_type]['IdleWakeupCount']) | 191 start_cpu_stats[process_type]['IdleWakeupCount']) |
190 cpu_delta[process_type] = idle_wakeup_delta.total_sum() | 192 cpu_delta[process_type] = idle_wakeup_delta.total_sum() |
191 total = total + cpu_delta[process_type] | 193 total = total + cpu_delta[process_type] |
192 cpu_delta['Total'] = total | 194 cpu_delta['Total'] = total |
193 return cpu_delta | 195 return cpu_delta |
OLD | NEW |