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 platform | 6 import platform |
7 import re | 7 import re |
8 | 8 |
9 from telemetry import decorators | 9 from telemetry import decorators |
10 from telemetry.internal.platform import power_monitor | 10 from telemetry.internal.platform import power_monitor |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 | 126 |
127 | 127 |
128 class MsrPowerMonitorWin(MsrPowerMonitor): | 128 class MsrPowerMonitorWin(MsrPowerMonitor): |
129 def CanMonitorPower(self): | 129 def CanMonitorPower(self): |
130 family, model = map(int, re.match('.+ Family ([0-9]+) Model ([0-9]+)', | 130 family, model = map(int, re.match('.+ Family ([0-9]+) Model ([0-9]+)', |
131 platform.processor()).groups()) | 131 platform.processor()).groups()) |
132 if not _IsSandyBridgeOrLater(platform.processor(), family, model): | 132 if not _IsSandyBridgeOrLater(platform.processor(), family, model): |
133 logging.info('Cannot monitor power: pre-Sandy Bridge CPU.') | 133 logging.info('Cannot monitor power: pre-Sandy Bridge CPU.') |
134 return False | 134 return False |
135 | 135 |
136 return self._CheckMSRs() | 136 msr_return_value = self._CheckMSRs() |
137 # Since _CheckMSRs() start the MSR server, we must close it after checking | |
dtu
2015/11/09 18:13:24
nit: starts
nednguyen
2015/11/09 18:16:44
Done.
| |
138 # to avoid leaking msr server process. | |
139 self._backend.CloseMsrServer() | |
dtu
2015/11/09 18:13:25
We need to do so on both Linux and Win, so perhaps
nednguyen
2015/11/09 18:16:44
CloseMsrServer is win_platform_backend only, updat
dtu
2015/11/09 18:25:46
Ah, yes, your'e right.
| |
140 return msr_return_value | |
141 | |
137 | 142 |
138 def StopMonitoringPower(self): | 143 def StopMonitoringPower(self): |
139 power_statistics = super(MsrPowerMonitorWin, self).StopMonitoringPower() | 144 power_statistics = super(MsrPowerMonitorWin, self).StopMonitoringPower() |
140 self._backend.CloseMsrServer() | 145 self._backend.CloseMsrServer() |
141 return power_statistics | 146 return power_statistics |
OLD | NEW |