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 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 Loading... | |
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_freq_hz = ( | |
89 self._results['component_utilization']['gpu']['average_frequency_mhz']) | |
90 results.Add('gpu_average_frequency_hz', 'hz', gpu_freq_hz) | |
tonyg
2014/04/01 16:19:43
Seems like we're missing the multiplication from m
| |
91 | |
88 # Add idle wakeup numbers for all processes. | 92 # Add idle wakeup numbers for all processes. |
89 for process_type in self._results['cpu_stats']: | 93 for process_type in self._results['cpu_stats']: |
90 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower()) | 94 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower()) |
91 results.Add(trace_name_for_process, 'count', | 95 results.Add(trace_name_for_process, 'count', |
92 self._results['cpu_stats'][process_type]) | 96 self._results['cpu_stats'][process_type]) |
93 | 97 |
94 self._results = None | 98 self._results = None |
95 | 99 |
96 def _SubtractCpuStats(cpu_stats, start_cpu_stats): | 100 def _SubtractCpuStats(cpu_stats, start_cpu_stats): |
97 """Computes number of idle wakeups that occurred over measurement period. | 101 """Computes number of idle wakeups that occurred over measurement period. |
98 | 102 |
99 Each of the two cpu_stats arguments is a dict as returned by the | 103 Each of the two cpu_stats arguments is a dict as returned by the |
100 Browser.cpu_stats call. | 104 Browser.cpu_stats call. |
101 | 105 |
102 Returns: | 106 Returns: |
103 A dict of process type names (Browser, Renderer, etc.) to idle wakeup count | 107 A dict of process type names (Browser, Renderer, etc.) to idle wakeup count |
104 over the period recorded by the input. | 108 over the period recorded by the input. |
105 """ | 109 """ |
106 cpu_delta = {} | 110 cpu_delta = {} |
107 for process_type in cpu_stats: | 111 for process_type in cpu_stats: |
108 assert process_type in start_cpu_stats, 'Mismatching process types' | 112 assert process_type in start_cpu_stats, 'Mismatching process types' |
109 # Skip any process_types that are empty. | 113 # Skip any process_types that are empty. |
110 if (not cpu_stats[process_type]) or (not start_cpu_stats[process_type]): | 114 if (not cpu_stats[process_type]) or (not start_cpu_stats[process_type]): |
111 continue | 115 continue |
112 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - | 116 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - |
113 start_cpu_stats[process_type]['IdleWakeupCount']) | 117 start_cpu_stats[process_type]['IdleWakeupCount']) |
114 cpu_delta[process_type] = idle_wakeup_delta | 118 cpu_delta[process_type] = idle_wakeup_delta |
115 return cpu_delta | 119 return cpu_delta |
OLD | NEW |