| 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 # IPPET disabled because of flakiness (crbug.com/336558). |
| 75 if True: |
| 76 return False |
| 77 |
| 74 if not win32event: | 78 if not win32event: |
| 75 return False | 79 return False |
| 76 | 80 |
| 77 windows_7_or_later = ( | 81 windows_7_or_later = ( |
| 78 self._backend.GetOSName() == 'win' and | 82 self._backend.GetOSName() == 'win' and |
| 79 self._backend.GetOSVersionName() >= platform_backend.WIN7) | 83 self._backend.GetOSVersionName() >= platform_backend.WIN7) |
| 80 if not windows_7_or_later: | 84 if not windows_7_or_later: |
| 81 return False | 85 return False |
| 82 | 86 |
| 83 # This check works on Windows only. | 87 # This check works on Windows only. |
| (...skipping 143 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. | 231 # Note that this is only an estimate of Chrome's CPU power usage. |
| 228 if chrome_keys: | 232 if chrome_keys: |
| 229 per_process_power_usage = [ | 233 per_process_power_usage = [ |
| 230 get(key, 'CPU Power W', default=0, mult=1000) for key in chrome_keys] | 234 get(key, 'CPU Power W', default=0, mult=1000) for key in chrome_keys] |
| 231 result['application_energy_consumption_mwh'] = ( | 235 result['application_energy_consumption_mwh'] = ( |
| 232 sum(map(operator.mul, | 236 sum(map(operator.mul, |
| 233 map(sum, zip(*per_process_power_usage)), | 237 map(sum, zip(*per_process_power_usage)), |
| 234 get('sys', 'Interval(secs)', mult=1./3600.)))) | 238 get('sys', 'Interval(secs)', mult=1./3600.)))) |
| 235 | 239 |
| 236 return result | 240 return result |
| OLD | NEW |