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

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

Issue 1440013002: [Android][Telemetry] Add logging and temporarily ensure StopMonitoringPower is called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/memory.py ('k') | tools/telemetry/telemetry/core/platform.py » ('j') | 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 import logging 4 import logging
5 import time 5 import time
6 6
7 from telemetry.util import process_statistic_timeline_data 7 from telemetry.util import process_statistic_timeline_data
8 from telemetry.value import scalar 8 from telemetry.value import scalar
9 9
10 from metrics import Metric 10 from metrics import Metric
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 self._running = True 84 self._running = True
85 85
86 def Stop(self, _, tab): 86 def Stop(self, _, tab):
87 if (not self._platform.CanMonitorPower() or 87 if (not self._platform.CanMonitorPower() or
88 not self._browser.supports_power_metrics): 88 not self._browser.supports_power_metrics):
89 return 89 return
90 90
91 self._StopInternal() 91 self._StopInternal()
92 92
93 def Close(self): 93 def Close(self):
94 # TODO(rnephew): Remove when crbug.com/553601 is solved.
95 logging.info('Closing power monitors')
94 if self._platform.IsMonitoringPower(): 96 if self._platform.IsMonitoringPower():
95 self._platform.StopMonitoringPower() 97 self._platform.StopMonitoringPower()
96 98
97 def AddResults(self, _, results): 99 def AddResults(self, _, results):
98 """Add the collected power data into the results object. 100 """Add the collected power data into the results object.
99 101
100 This function needs to be robust in the face of differing power data on 102 This function needs to be robust in the face of differing power data on
101 various platforms. Therefore data existence needs to be checked when 103 various platforms. Therefore data existence needs to be checked when
102 building up the results. Additionally 0 is a valid value for many of the 104 building up the results. Additionally 0 is a valid value for many of the
103 metrics here which is why there are plenty of checks for 'is not None' 105 metrics here which is why there are plenty of checks for 'is not None'
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 continue 207 continue
206 208
207 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], 209 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'],
208 process_statistic_timeline_data.IdleWakeupTimelineData) 210 process_statistic_timeline_data.IdleWakeupTimelineData)
209 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - 211 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] -
210 start_cpu_stats[process_type]['IdleWakeupCount']) 212 start_cpu_stats[process_type]['IdleWakeupCount'])
211 cpu_delta[process_type] = idle_wakeup_delta.total_sum() 213 cpu_delta[process_type] = idle_wakeup_delta.total_sum()
212 total = total + cpu_delta[process_type] 214 total = total + cpu_delta[process_type]
213 cpu_delta['Total'] = total 215 cpu_delta['Total'] = total
214 return cpu_delta 216 return cpu_delta
OLDNEW
« no previous file with comments | « tools/perf/measurements/memory.py ('k') | tools/telemetry/telemetry/core/platform.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698