Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: tools/telemetry/telemetry/internal/platform/power_monitor/msr_power_monitor.py

Issue 1411843011: [Telemetry] Close msr server win after checking whether platform can monitor power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698