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 csv | 5 import csv |
6 import logging | 6 import logging |
7 import operator | 7 import operator |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import re | 10 import re |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 64 |
65 class IppetPowerMonitor(power_monitor.PowerMonitor): | 65 class IppetPowerMonitor(power_monitor.PowerMonitor): |
66 def __init__(self, backend): | 66 def __init__(self, backend): |
67 super(IppetPowerMonitor, self).__init__() | 67 super(IppetPowerMonitor, self).__init__() |
68 self._backend = backend | 68 self._backend = backend |
69 self._ippet_handle = None | 69 self._ippet_handle = None |
70 self._ippet_port = None | 70 self._ippet_port = None |
71 self._output_dir = None | 71 self._output_dir = None |
72 | 72 |
73 def CanMonitorPower(self): | 73 def CanMonitorPower(self): |
74 if not win32event: | 74 # IPPET disabled because of flakiness (crbug.com/336558). |
75 if (not win32event) or True: | |
Sami
2014/08/06 13:59:10
FWIW, I did this instead of "return False" to avoi
rmcilroy
2014/08/06 14:06:13
nit - could you just do an:
if True:
return Fals
| |
75 return False | 76 return False |
76 | 77 |
77 windows_7_or_later = ( | 78 windows_7_or_later = ( |
78 self._backend.GetOSName() == 'win' and | 79 self._backend.GetOSName() == 'win' and |
79 self._backend.GetOSVersionName() >= platform_backend.WIN7) | 80 self._backend.GetOSVersionName() >= platform_backend.WIN7) |
80 if not windows_7_or_later: | 81 if not windows_7_or_later: |
81 return False | 82 return False |
82 | 83 |
83 # This check works on Windows only. | 84 # This check works on Windows only. |
84 family, model = map(int, re.match('.+ Family ([0-9]+) Model ([0-9]+)', | 85 family, model = map(int, re.match('.+ Family ([0-9]+) Model ([0-9]+)', |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 # Note that this is only an estimate of Chrome's CPU power usage. | 228 # Note that this is only an estimate of Chrome's CPU power usage. |
228 if chrome_keys: | 229 if chrome_keys: |
229 per_process_power_usage = [ | 230 per_process_power_usage = [ |
230 get(key, 'CPU Power W', default=0, mult=1000) for key in chrome_keys] | 231 get(key, 'CPU Power W', default=0, mult=1000) for key in chrome_keys] |
231 result['application_energy_consumption_mwh'] = ( | 232 result['application_energy_consumption_mwh'] = ( |
232 sum(map(operator.mul, | 233 sum(map(operator.mul, |
233 map(sum, zip(*per_process_power_usage)), | 234 map(sum, zip(*per_process_power_usage)), |
234 get('sys', 'Interval(secs)', mult=1./3600.)))) | 235 get('sys', 'Interval(secs)', mult=1./3600.)))) |
235 | 236 |
236 return result | 237 return result |
OLD | NEW |