| 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 import time | 6 import time |
| 7 | 7 |
| 8 from telemetry.util import process_statistic_timeline_data | 8 from telemetry.util import process_statistic_timeline_data |
| 9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 component_utilization = self._results.get('component_utilization', {}) | 154 component_utilization = self._results.get('component_utilization', {}) |
| 155 # GPU Frequency. | 155 # GPU Frequency. |
| 156 gpu_power = component_utilization.get('gpu', {}) | 156 gpu_power = component_utilization.get('gpu', {}) |
| 157 gpu_freq_hz = gpu_power.get('average_frequency_hz') | 157 gpu_freq_hz = gpu_power.get('average_frequency_hz') |
| 158 if gpu_freq_hz is not None: | 158 if gpu_freq_hz is not None: |
| 159 results.AddValue(scalar.ScalarValue( | 159 results.AddValue(scalar.ScalarValue( |
| 160 results.current_page, 'gpu_average_frequency_hz', 'hz', gpu_freq_hz, | 160 results.current_page, 'gpu_average_frequency_hz', 'hz', gpu_freq_hz, |
| 161 important=False)) | 161 important=False)) |
| 162 | 162 |
| 163 # GPU Frequency. |
| 164 chrome_power = component_utilization.get('chrome', None) |
| 165 if chrome_power is not None: |
| 166 results.AddValue(scalar.ScalarValue( |
| 167 results.current_page, 'cputime', 'ms per s', |
| 168 chrome_power['cputime_ms_per_s'], important=False)) |
| 169 results.AddValue(scalar.ScalarValue( |
| 170 results.current_page, 'energy_impact', 'unitless', |
| 171 chrome_power['energy_impact'], important=False)) |
| 172 results.AddValue(scalar.ScalarValue( |
| 173 results.current_page, 'idle_wakeups', '# per s', |
| 174 chrome_power['idle_wakeups_per_s'], important=False)) |
| 175 |
| 163 # Add idle wakeup numbers for all processes. | 176 # Add idle wakeup numbers for all processes. |
| 164 for (process_type, stats) in self._results.get('cpu_stats', {}).items(): | 177 for (process_type, stats) in self._results.get('cpu_stats', {}).items(): |
| 165 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower()) | 178 trace_name_for_process = 'idle_wakeups_%s' % (process_type.lower()) |
| 166 results.AddValue(scalar.ScalarValue( | 179 results.AddValue(scalar.ScalarValue( |
| 167 results.current_page, trace_name_for_process, 'count', stats, | 180 results.current_page, trace_name_for_process, 'count', stats, |
| 168 important=False)) | 181 important=False)) |
| 169 | 182 |
| 170 # Add temperature measurements. | 183 # Add temperature measurements. |
| 171 platform_info_utilization = self._results.get('platform_info', {}) | 184 platform_info_utilization = self._results.get('platform_info', {}) |
| 172 board_temperature_c = platform_info_utilization.get( | 185 board_temperature_c = platform_info_utilization.get( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 continue | 233 continue |
| 221 | 234 |
| 222 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], | 235 assert isinstance(cpu_stats[process_type]['IdleWakeupCount'], |
| 223 process_statistic_timeline_data.IdleWakeupTimelineData) | 236 process_statistic_timeline_data.IdleWakeupTimelineData) |
| 224 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - | 237 idle_wakeup_delta = (cpu_stats[process_type]['IdleWakeupCount'] - |
| 225 start_cpu_stats[process_type]['IdleWakeupCount']) | 238 start_cpu_stats[process_type]['IdleWakeupCount']) |
| 226 cpu_delta[process_type] = idle_wakeup_delta.total_sum() | 239 cpu_delta[process_type] = idle_wakeup_delta.total_sum() |
| 227 total = total + cpu_delta[process_type] | 240 total = total + cpu_delta[process_type] |
| 228 cpu_delta['Total'] = total | 241 cpu_delta['Total'] = total |
| 229 return cpu_delta | 242 return cpu_delta |
| OLD | NEW |