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

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

Issue 220963003: [Telemetry] Output average GPU frequency from power metric (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: average_freq_mhz -> average_freq_hz Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/power_monitor/powermetrics_power_monitor.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 4
5 import logging 5 import logging
6 6
7 from metrics import Metric 7 from metrics import Metric
8 from telemetry.core.platform import factory 8 from telemetry.core.platform import factory
9 9
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 self._StopInternal() 79 self._StopInternal()
80 80
81 def AddResults(self, _, results): 81 def AddResults(self, _, results):
82 if not self._results: 82 if not self._results:
83 return 83 return
84 84
85 energy_consumption_mwh = self._results['energy_consumption_mwh'] 85 energy_consumption_mwh = self._results['energy_consumption_mwh']
86 results.Add('energy_consumption_mwh', 'mWh', energy_consumption_mwh) 86 results.Add('energy_consumption_mwh', 'mWh', energy_consumption_mwh)
87 87
88 # GPU Frequency.
89 gpu_power = self._results['component_utilization'].get('gpu', None)
90 if gpu_power and gpu_power.has_key('average_frequency_hz'):
91 gpu_freq_hz = gpu_power['average_frequency_hz']
92 results.Add('gpu_average_frequency_hz', 'hz', gpu_freq_hz)
93
88 # Add idle wakeup numbers for all processes. 94 # Add idle wakeup numbers for all processes.
89 for process_type in self._results['cpu_stats']: 95 for process_type in self._results['cpu_stats']:
90 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower()) 96 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower())
91 results.Add(trace_name_for_process, 'count', 97 results.Add(trace_name_for_process, 'count',
92 self._results['cpu_stats'][process_type]) 98 self._results['cpu_stats'][process_type])
93 99
94 self._results = None 100 self._results = None
95 101
96 def _SubtractCpuStats(cpu_stats, start_cpu_stats): 102 def _SubtractCpuStats(cpu_stats, start_cpu_stats):
97 """Computes number of idle wakeups that occurred over measurement period. 103 """Computes number of idle wakeups that occurred over measurement period.
98 104
99 Each of the two cpu_stats arguments is a dict as returned by the 105 Each of the two cpu_stats arguments is a dict as returned by the
100 Browser.cpu_stats call. 106 Browser.cpu_stats call.
101 107
102 Returns: 108 Returns:
103 A dict of process type names (Browser, Renderer, etc.) to idle wakeup count 109 A dict of process type names (Browser, Renderer, etc.) to idle wakeup count
104 over the period recorded by the input. 110 over the period recorded by the input.
105 """ 111 """
106 cpu_delta = {} 112 cpu_delta = {}
107 for process_type in cpu_stats: 113 for process_type in cpu_stats:
108 assert process_type in start_cpu_stats, 'Mismatching process types' 114 assert process_type in start_cpu_stats, 'Mismatching process types'
109 # Skip any process_types that are empty. 115 # Skip any process_types that are empty.
110 if (not cpu_stats[process_type]) or (not start_cpu_stats[process_type]): 116 if (not cpu_stats[process_type]) or (not start_cpu_stats[process_type]):
111 continue 117 continue
112 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - 118 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] -
113 start_cpu_stats[process_type]['IdleWakeupCount']) 119 start_cpu_stats[process_type]['IdleWakeupCount'])
114 cpu_delta[process_type] = idle_wakeup_delta 120 cpu_delta[process_type] = idle_wakeup_delta
115 return cpu_delta 121 return cpu_delta
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/power_monitor/powermetrics_power_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698