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

Side by Side Diff: tools/perf/metrics/power.py

Issue 649903003: [Telemetry] Fix application_energy_consumption output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« 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