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

Side by Side Diff: tools/telemetry/telemetry/core/chrome/platform.py

Issue 11428107: Telemetry: extends Platform abstraction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: __init__/close() Created 7 years, 10 months 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 class Platform(object): 5 class Platform(object):
6 """The platform that the target browser is running on. 6 """The platform that the target browser is running on.
7 7
8 Provides a limited interface to obtain stats from the platform itself, where 8 Provides a limited interface to interact with the platform itself, where
9 possible. 9 possible. It's important to note that platforms may not provide a specific
10 API, so check with IsFooBar() for availability.
10 """ 11 """
12 def __init__(self, platform_backend):
achuithb 2013/02/25 21:18:08 This breaks PosssibleCrOSBrowser.Create at line 30
13 self._platform_backend = platform_backend
11 14
12 def GetSurfaceCollector(self, trace_tag): 15 def IsRawDisplayFrameRateSupported(self):
13 """Platforms may be able to collect GL surface stats.""" 16 """Platforms may be able to collect GL surface stats."""
14 class StubSurfaceCollector(object): 17 return self._platform_backend.IsRawDisplayFrameRateSupported()
15 def __init__(self, trace_tag):
16 pass
17 def __enter__(self):
18 pass
19 def __exit__(self, *args):
20 pass
21 18
22 return StubSurfaceCollector(trace_tag) 19 def StartRawDisplayFrameRateMeasurement(self, trace_tag):
20 """Start measuring GL surface stats."""
21 return self._platform_backend.StartRawDisplayFrameRateMeasurement(trace_tag)
22
23 def StopRawDisplayFrameRateMeasurement(self):
24 """Stop measuring GL surface stats and print results."""
25 return self._platform_backend.StopRawDisplayFrameRateMeasurement()
26
27 def SetFullPerformanceModeEnabled(self, enabled):
28 """Platforms may tweak their CPU governor, system status, etc.
29
30 Most platforms can operate in a battery saving mode. While good for battery
31 life, this can cause confusing performance results and add noise. Turning
32 full performance mode on disables these features, which is useful for
33 performance testing.
34 """
35 return self._platform_backend.SetFullPerformanceModeEnabled(enabled)
36
37 def CanMonitorThermalThrottling(self):
38 """Platforms may be able to detect thermal throttling.
39
40 Some fan-less computers go into a reduced performance mode when their heat
41 exceeds a certain threshold. Performance tests in particular should use this
42 API to detect if this has happened and interpret results accordingly.
43 """
44 return self._platform_backend.CanMonitorThermalThrottling()
45
46 def IsThermallyThrottled(self):
47 """Returns True if the device is currently thermally throttled."""
48 return self._platform_backend.IsThermallyThrottled()
49
50 def HasBeenThermallyThrottled(self):
51 """Returns True if the device has been thermally throttled."""
52 return self._platform_backend.HasBeenThermallyThrottled()
53
54
55 def EmptyPlatform():
56 class EmptyPlatformBackend(object):
57 def IsRawDisplayFrameRateSupported(self):
58 return False
59
60 def StartRawDisplayFrameRateMeasurement(self, _):
61 return NotImplementedError()
62
63 def StopRawDisplayFrameRateMeasurement(self):
64 return NotImplementedError()
65
66 def SetFullPerformanceModeEnabled(self, enabled):
67 pass
68
69 def CanMonitorThermalThrottling(self):
70 return False
71
72 def IsThermallyThrottled(self):
73 return NotImplementedError()
74
75 def HasBeenThermallyThrottled(self):
76 return NotImplementedError()
77
78 return Platform(EmptyPlatformBackend())
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py ('k') | tools/telemetry/telemetry/page/page_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698