| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 ctypes | 5 import ctypes |
| 6 import os | 6 import os |
| 7 import time | 7 import time |
| 8 try: | 8 try: |
| 9 import resource # pylint: disable=F0401 | 9 import resource # pylint: disable=F0401 |
| 10 except ImportError: | 10 except ImportError: |
| 11 resource = None # Not available on all platforms | 11 resource = None # Not available on all platforms |
| 12 | 12 |
| 13 from telemetry import decorators | 13 from telemetry import decorators |
| 14 from telemetry.core.platform import platform_backend | 14 from telemetry.core.platform import platform_backend |
| 15 from telemetry.core.platform import posix_platform_backend | 15 from telemetry.core.platform import posix_platform_backend |
| 16 from telemetry.core.platform.power_monitor import powermetrics_power_monitor | 16 from telemetry.core.platform.power_monitor import powermetrics_power_monitor |
| 17 | 17 |
| 18 | 18 |
| 19 class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend): | 19 class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend): |
| 20 def __init__(self): | 20 def __init__(self): |
| 21 super(MacPlatformBackend, self).__init__() | 21 super(MacPlatformBackend, self).__init__() |
| 22 self.libproc = None | 22 self.libproc = None |
| 23 self.power_monitor_ = powermetrics_power_monitor.PowerMetricsPowerMonitor( | 23 self._power_monitor = powermetrics_power_monitor.PowerMetricsPowerMonitor( |
| 24 self) | 24 self) |
| 25 | 25 |
| 26 def StartRawDisplayFrameRateMeasurement(self): | 26 def StartRawDisplayFrameRateMeasurement(self): |
| 27 raise NotImplementedError() | 27 raise NotImplementedError() |
| 28 | 28 |
| 29 def StopRawDisplayFrameRateMeasurement(self): | 29 def StopRawDisplayFrameRateMeasurement(self): |
| 30 raise NotImplementedError() | 30 raise NotImplementedError() |
| 31 | 31 |
| 32 def GetRawDisplayFrameRateMeasurements(self): | 32 def GetRawDisplayFrameRateMeasurements(self): |
| 33 raise NotImplementedError() | 33 raise NotImplementedError() |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 def CanFlushIndividualFilesFromSystemCache(self): | 145 def CanFlushIndividualFilesFromSystemCache(self): |
| 146 return False | 146 return False |
| 147 | 147 |
| 148 def FlushEntireSystemCache(self): | 148 def FlushEntireSystemCache(self): |
| 149 mavericks_or_later = self.GetOSVersionName() >= platform_backend.MAVERICKS | 149 mavericks_or_later = self.GetOSVersionName() >= platform_backend.MAVERICKS |
| 150 p = self.LaunchApplication('purge', elevate_privilege=mavericks_or_later) | 150 p = self.LaunchApplication('purge', elevate_privilege=mavericks_or_later) |
| 151 p.communicate() | 151 p.communicate() |
| 152 assert p.returncode == 0, 'Failed to flush system cache' | 152 assert p.returncode == 0, 'Failed to flush system cache' |
| 153 | 153 |
| 154 def CanMonitorPower(self): | 154 def CanMonitorPower(self): |
| 155 return self.power_monitor_.CanMonitorPower() | 155 return self._power_monitor.CanMonitorPower() |
| 156 | 156 |
| 157 def CanMeasurePerApplicationPower(self): | 157 def CanMeasurePerApplicationPower(self): |
| 158 return self.power_monitor_.CanMeasurePerApplicationPower() | 158 return self._power_monitor.CanMeasurePerApplicationPower() |
| 159 | 159 |
| 160 def StartMonitoringPower(self, browser): | 160 def StartMonitoringPower(self, browser): |
| 161 self.power_monitor_.StartMonitoringPower(browser) | 161 self._power_monitor.StartMonitoringPower(browser) |
| 162 | 162 |
| 163 def StopMonitoringPower(self): | 163 def StopMonitoringPower(self): |
| 164 return self.power_monitor_.StopMonitoringPower() | 164 return self._power_monitor.StopMonitoringPower() |
| OLD | NEW |