Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / platform / platform_backend.py
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import time
6
7 # pylint: disable=W0613
8
9
10 # pylint: disable=W0212
11 class OSVersion(str):
12   def __new__(cls, friendly_name, sortable_name, *args, **kwargs):
13     version = str.__new__(cls, friendly_name)
14     version._sortable_name = sortable_name
15     return version
16
17   def __lt__(self, other):
18     return self._sortable_name < other._sortable_name
19
20   def __gt__(self, other):
21     return self._sortable_name > other._sortable_name
22
23   def __le__(self, other):
24     return self._sortable_name <= other._sortable_name
25
26   def __ge__(self, other):
27     return self._sortable_name >= other._sortable_name
28
29
30 class PlatformBackend(object):
31   def IsRawDisplayFrameRateSupported(self):
32     return False
33
34   def StartRawDisplayFrameRateMeasurement(self):
35     raise NotImplementedError()
36
37   def StopRawDisplayFrameRateMeasurement(self):
38     raise NotImplementedError()
39
40   def GetRawDisplayFrameRateMeasurements(self):
41     raise NotImplementedError()
42
43   def SetFullPerformanceModeEnabled(self, enabled):
44     pass
45
46   def CanMonitorThermalThrottling(self):
47     return False
48
49   def IsThermallyThrottled(self):
50     raise NotImplementedError()
51
52   def HasBeenThermallyThrottled(self):
53     raise NotImplementedError()
54
55   def GetSystemCommitCharge(self):
56     raise NotImplementedError()
57
58   def GetSystemTotalPhysicalMemory(self):
59     raise NotImplementedError()
60
61   def GetCpuStats(self, pid):
62     return {}
63
64   def GetCpuTimestamp(self):
65     return {}
66
67   def PurgeUnpinnedMemory(self):
68     pass
69
70   def GetMemoryStats(self, pid):
71     return {}
72
73   def GetIOStats(self, pid):
74     return {}
75
76   def GetChildPids(self, pid):
77     raise NotImplementedError()
78
79   def GetCommandLine(self, pid):
80     raise NotImplementedError()
81
82   def GetOSName(self):
83     raise NotImplementedError()
84
85   def GetOSVersionName(self):
86     raise NotImplementedError()
87
88   def CanFlushIndividualFilesFromSystemCache(self):
89     raise NotImplementedError()
90
91   def FlushEntireSystemCache(self):
92     raise NotImplementedError()
93
94   def FlushSystemCacheForDirectory(self, directory, ignoring=None):
95     raise NotImplementedError()
96
97   def LaunchApplication(
98       self, application, parameters=None, elevate_privilege=False):
99     raise NotImplementedError()
100
101   def IsApplicationRunning(self, application):
102     raise NotImplementedError()
103
104   def CanLaunchApplication(self, application):
105     return False
106
107   def InstallApplication(self, application):
108     raise NotImplementedError()
109
110   def CanCaptureVideo(self):
111     return False
112
113   def StartVideoCapture(self, min_bitrate_mbps):
114     raise NotImplementedError()
115
116   def StopVideoCapture(self):
117     raise NotImplementedError()
118
119   def CanMonitorPowerSync(self):
120     return self.CanMonitorPowerAsync()
121
122   def MonitorPowerSync(self, duration_ms):
123     self.StartMonitoringPowerAsync()
124     time.sleep(duration_ms / 1000.)
125     return self.StopMonitoringPowerAsync()
126
127   def CanMonitorPowerAsync(self):
128     return False
129
130   def StartMonitoringPowerAsync(self):
131     raise NotImplementedError()
132
133   def StopMonitoringPowerAsync(self):
134     raise NotImplementedError()