OLD | NEW |
| (Empty) |
1 | |
2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
3 <html><head><title>Python: module telemetry.core.platform</title> | |
4 <meta charset="utf-8"> | |
5 </head><body bgcolor="#f0f0f8"> | |
6 | |
7 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> | |
8 <tr bgcolor="#7799ee"> | |
9 <td valign=bottom> <br> | |
10 <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a hre
f="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry
.core.html"><font color="#ffffff">core</font></a>.platform</strong></big></big><
/font></td | |
11 ><td align=right valign=bottom | |
12 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href=
"../telemetry/core/platform.py">telemetry/core/platform.py</a></font></td></tr><
/table> | |
13 <p><tt># Copyright 2012 The Chromium Authors.
All rights reserved.<br> | |
14 # Use of this source code is governed by
a BSD-style license that can be<br> | |
15 # found in the LICENSE file.</tt></p> | |
16 <p> | |
17 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
18 <tr bgcolor="#aa55cc"> | |
19 <td colspan=3 valign=bottom> <br> | |
20 <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big
></font></td></tr> | |
21 | |
22 <tr><td bgcolor="#aa55cc"><tt> </tt></td><td>
</td> | |
23 <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=t
op><a href="telemetry.core.discover.html">telemetry.core.discover</a><br> | |
24 <a href="telemetry.core.local_server.html">telemetry.core.local_server</a><br> | |
25 <a href="telemetry.core.memory_cache_http_server.html">telemetry.core.memory_cac
he_http_server</a><br> | |
26 </td><td width="25%" valign=top><a href="telemetry.core.network_controller.html"
>telemetry.core.network_controller</a><br> | |
27 <a href="os.html">os</a><br> | |
28 <a href="telemetry.internal.platform.platform_backend.html">telemetry.internal.p
latform.platform_backend</a><br> | |
29 </td><td width="25%" valign=top><a href="logging.html">logging</a><br> | |
30 <a href="telemetry.core.tracing_controller.html">telemetry.core.tracing_controll
er</a><br> | |
31 <a href="telemetry.core.util.html">telemetry.core.util</a><br> | |
32 </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> | |
33 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
34 <tr bgcolor="#ee77aa"> | |
35 <td colspan=3 valign=bottom> <br> | |
36 <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big
></font></td></tr> | |
37 | |
38 <tr><td bgcolor="#ee77aa"><tt> </tt></td><td>
</td> | |
39 <td width="100%"><dl> | |
40 <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.
object</a> | |
41 </font></dt><dd> | |
42 <dl> | |
43 <dt><font face="helvetica, arial"><a href="telemetry.core.platform.html#Platform
">Platform</a> | |
44 </font></dt></dl> | |
45 </dd> | |
46 </dl> | |
47 <p> | |
48 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
49 <tr bgcolor="#ffc8d8"> | |
50 <td colspan=3 valign=bottom> <br> | |
51 <font color="#000000" face="helvetica, arial"><a name="Platform">class <strong>P
latform</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</
font></td></tr> | |
52 | |
53 <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> | |
54 <td colspan=2><tt>The platform that the target browser&
nbsp;is running on.<br> | |
55 <br> | |
56 Provides a limited interface to interact with 
;the platform itself, where<br> | |
57 possible. It's important to note that platforms&nb
sp;may not provide a specific<br> | |
58 API, so check with IsFooBar() for availability.<br
> </tt></td></tr> | |
59 <tr><td> </td> | |
60 <td width="100%">Methods defined here:<br> | |
61 <dl><dt><a name="Platform-CanCaptureVideo"><strong>CanCaptureVideo</strong></a>(
self)</dt><dd><tt>Returns a bool indicating whether the
platform supports video capture.</tt></dd></dl> | |
62 | |
63 <dl><dt><a name="Platform-CanFlushIndividualFilesFromSystemCache"><strong>CanFlu
shIndividualFilesFromSystemCache</strong></a>(self)</dt><dd><tt>Returns tru
e if the disk cache can be flushed for&n
bsp;specific files.</tt></dd></dl> | |
64 | |
65 <dl><dt><a name="Platform-CanLaunchApplication"><strong>CanLaunchApplication</st
rong></a>(self, application)</dt><dd><tt>Returns whether the plat
form can launch the given application.</tt></dd></dl> | |
66 | |
67 <dl><dt><a name="Platform-CanMeasurePerApplicationPower"><strong>CanMeasurePerAp
plicationPower</strong></a>(self)</dt><dd><tt>Returns True if the
power monitor can measure power for the 
;target<br> | |
68 application in isolation. False if power measureme
nt is for full system<br> | |
69 energy consumption.</tt></dd></dl> | |
70 | |
71 <dl><dt><a name="Platform-CanMonitorNetworkData"><strong>CanMonitorNetworkData</
strong></a>(self)</dt><dd><tt>Returns true if network data&n
bsp;can be retrieved, false otherwise.</tt></dd></dl> | |
72 | |
73 <dl><dt><a name="Platform-CanMonitorPower"><strong>CanMonitorPower</strong></a>(
self)</dt><dd><tt>Returns True iff power can be mo
nitored asynchronously via<br> | |
74 <a href="#Platform-StartMonitoringPower">StartMonitoringPower</a>() and&nbs
p;<a href="#Platform-StopMonitoringPower">StopMonitoringPower</a>().</tt></dd></
dl> | |
75 | |
76 <dl><dt><a name="Platform-CanMonitorThermalThrottling"><strong>CanMonitorThermal
Throttling</strong></a>(self)</dt><dd><tt>Platforms may be able&n
bsp;to detect thermal throttling.<br> | |
77 <br> | |
78 Some fan-less computers go into a reduced per
formance mode when their heat<br> | |
79 exceeds a certain threshold. Performance tests in&
nbsp;particular should use this<br> | |
80 API to detect if this has happened and i
nterpret results accordingly.</tt></dd></dl> | |
81 | |
82 <dl><dt><a name="Platform-CanTakeScreenshot"><strong>CanTakeScreenshot</strong><
/a>(self)</dt></dl> | |
83 | |
84 <dl><dt><a name="Platform-CooperativelyShutdown"><strong>CooperativelyShutdown</
strong></a>(self, proc, app_name)</dt><dd><tt>Cooperatively shut down&
nbsp;the given process from subprocess.Popen.<br> | |
85 <br> | |
86 Currently this is only implemented on Windows.&nbs
p;See<br> | |
87 crbug.com/424024 for background on why it was 
;added.<br> | |
88 <br> | |
89 Args:<br> | |
90 proc: a process <a href="__builtin__.html#object">obj
ect</a> returned from subprocess.Popen.<br> | |
91 app_name: on Windows, is the prefix of
the application's window<br> | |
92 class name that should b
e searched for. This helps ensure<br> | |
93 that only the application's&n
bsp;windows are closed.<br> | |
94 <br> | |
95 Returns True if it is believed the attempt&nb
sp;succeeded.</tt></dd></dl> | |
96 | |
97 <dl><dt><a name="Platform-FlushDnsCache"><strong>FlushDnsCache</strong></a>(self
)</dt><dd><tt>Flushes the OS's DNS cache completely.<br
> | |
98 <br> | |
99 This function may require root or administrator&nb
sp;access.</tt></dd></dl> | |
100 | |
101 <dl><dt><a name="Platform-FlushEntireSystemCache"><strong>FlushEntireSystemCache
</strong></a>(self)</dt><dd><tt>Flushes the OS's file cache&
nbsp;completely.<br> | |
102 <br> | |
103 This function may require root or administrator&nb
sp;access.</tt></dd></dl> | |
104 | |
105 <dl><dt><a name="Platform-FlushSystemCacheForDirectory"><strong>FlushSystemCache
ForDirectory</strong></a>(self, directory)</dt><dd><tt>Flushes the OS'
s file cache for the specified directory.<br> | |
106 <br> | |
107 This function does not require root or admini
strator access.</tt></dd></dl> | |
108 | |
109 <dl><dt><a name="Platform-GetArchName"><strong>GetArchName</strong></a>(self)</d
t><dd><tt>Returns a string description of the <a h
ref="#Platform">Platform</a> architecture.<br> | |
110 <br> | |
111 Examples: x86_64 (posix), AMD64 (win), armeabi-v7a,&nbs
p;x86</tt></dd></dl> | |
112 | |
113 <dl><dt><a name="Platform-GetDeviceTypeName"><strong>GetDeviceTypeName</strong><
/a>(self)</dt><dd><tt>Returns a string description of t
he <a href="#Platform">Platform</a> device, or None.<br> | |
114 <br> | |
115 Examples: Nexus 7, Nexus 6, Desktop</tt></dd></dl> | |
116 | |
117 <dl><dt><a name="Platform-GetNetworkData"><strong>GetNetworkData</strong></a>(se
lf, browser)</dt><dd><tt>Get current network data.<br> | |
118 Returns:<br> | |
119 Tuple of (sent_data, received_data) in kb&n
bsp;if data can be found,<br> | |
120 None otherwise.</tt></dd></dl> | |
121 | |
122 <dl><dt><a name="Platform-GetOSName"><strong>GetOSName</strong></a>(self)</dt><d
d><tt>Returns a string description of the <a href=
"#Platform">Platform</a> OS.<br> | |
123 <br> | |
124 Examples: WIN, MAC, LINUX, CHROMEOS</tt></dd></dl> | |
125 | |
126 <dl><dt><a name="Platform-GetOSVersionName"><strong>GetOSVersionName</strong></a
>(self)</dt><dd><tt>Returns a logically sortable, string-lik
e description of the <a href="#Platform">Platform</a> O
S<br> | |
127 version.<br> | |
128 <br> | |
129 Examples: VISTA, WIN7, LION, MOUNTAINLION</tt></dd></dl> | |
130 | |
131 <dl><dt><a name="Platform-GetOSVersionNumber"><strong>GetOSVersionNumber</strong
></a>(self)</dt><dd><tt>Returns an integer description of&nb
sp;the <a href="#Platform">Platform</a> OS major version.<br
> | |
132 <br> | |
133 Examples: On Mac, 13 for Mavericks, 14 for&nb
sp;Yosemite.</tt></dd></dl> | |
134 | |
135 <dl><dt><a name="Platform-HasBeenThermallyThrottled"><strong>HasBeenThermallyThr
ottled</strong></a>(self)</dt><dd><tt>Returns True if the de
vice has been thermally throttled.</tt></dd></dl> | |
136 | |
137 <dl><dt><a name="Platform-InstallApplication"><strong>InstallApplication</strong
></a>(self, application)</dt><dd><tt>Installs the given applicati
on.</tt></dd></dl> | |
138 | |
139 <dl><dt><a name="Platform-IsApplicationRunning"><strong>IsApplicationRunning</st
rong></a>(self, application)</dt><dd><tt>Returns whether an appli
cation is currently running.</tt></dd></dl> | |
140 | |
141 <dl><dt><a name="Platform-IsCooperativeShutdownSupported"><strong>IsCooperativeS
hutdownSupported</strong></a>(self)</dt><dd><tt>Indicates whether Coop
erativelyShutdown, below, is supported.<br> | |
142 It is not necessary to implement it on a
ll platforms.</tt></dd></dl> | |
143 | |
144 <dl><dt><a name="Platform-IsMonitoringPower"><strong>IsMonitoringPower</strong><
/a>(self)</dt><dd><tt>Returns true if power is currentl
y being monitored, false otherwise.</tt></dd></dl> | |
145 | |
146 <dl><dt><a name="Platform-IsThermallyThrottled"><strong>IsThermallyThrottled</st
rong></a>(self)</dt><dd><tt>Returns True if the device
is currently thermally throttled.</tt></dd></dl> | |
147 | |
148 <dl><dt><a name="Platform-LaunchApplication"><strong>LaunchApplication</strong><
/a>(self, application, parameters<font color="#909090">=None</font>, elevate_pri
vilege<font color="#909090">=False</font>)</dt><dd><tt>"Launches the g
iven |application| with a list of |parameters|&nbs
p;on the OS.<br> | |
149 <br> | |
150 Set |elevate_privilege| to launch the application
with root or admin rights.<br> | |
151 <br> | |
152 Returns:<br> | |
153 A popen style process handle for host&
nbsp;platforms.</tt></dd></dl> | |
154 | |
155 <dl><dt><a name="Platform-SetHTTPServerDirectories"><strong>SetHTTPServerDirecto
ries</strong></a>(self, paths)</dt><dd><tt>Returns True if the&nb
sp;HTTP server was started, False otherwise.</tt></dd><
/dl> | |
156 | |
157 <dl><dt><a name="Platform-StartLocalServer"><strong>StartLocalServer</strong></a
>(self, server)</dt><dd><tt>Starts a LocalServer and associa
tes it with this platform.<br> | |
158 |server.Close()| should be called manually to clos
e the started server.</tt></dd></dl> | |
159 | |
160 <dl><dt><a name="Platform-StartMonitoringPower"><strong>StartMonitoringPower</st
rong></a>(self, browser)</dt><dd><tt>Starts monitoring power util
ization statistics.<br> | |
161 <br> | |
162 Args:<br> | |
163 browser: The browser to monitor.</tt></dd></dl> | |
164 | |
165 <dl><dt><a name="Platform-StartVideoCapture"><strong>StartVideoCapture</strong><
/a>(self, min_bitrate_mbps)</dt><dd><tt>Starts capturing video.<br> | |
166 <br> | |
167 Outer framing may be included (from the OS,&n
bsp;browser window, and webcam).<br> | |
168 <br> | |
169 Args:<br> | |
170 min_bitrate_mbps: The minimum capture bitrate&nb
sp;in MegaBits Per Second.<br> | |
171 The platform is free to&
nbsp;deliver a higher bitrate if it can do&nb
sp;so<br> | |
172 without increasing overhead.<br> | |
173 <br> | |
174 Raises:<br> | |
175 ValueError if the required |min_bitrate_mbps|&nb
sp;can't be achieved.</tt></dd></dl> | |
176 | |
177 <dl><dt><a name="Platform-StopAllLocalServers"><strong>StopAllLocalServers</stro
ng></a>(self)</dt></dl> | |
178 | |
179 <dl><dt><a name="Platform-StopMonitoringPower"><strong>StopMonitoringPower</stro
ng></a>(self)</dt><dd><tt>Stops monitoring power utilization 
;and returns stats<br> | |
180 <br> | |
181 Returns:<br> | |
182 None if power measurement failed for s
ome reason, otherwise a dict of<br> | |
183 power utilization statistics containing: {<br> | |
184 # An identifier for the data&nb
sp;provider. Allows to evaluate the precision<br> | |
185 # of the data. Example values:&
nbsp;monsoon, powermetrics, ds2784<br> | |
186 'identifier': identifier,<br> | |
187 <br> | |
188 # The instantaneous power (voltage&n
bsp;* current) reading in milliwatts at<br> | |
189 # each sample.<br> | |
190 'power_samples_mw': [mw0, mw1, ...,
mwN],<br> | |
191 <br> | |
192 # The full system energy consum
ption during the sampling period in<br> | |
193 # milliwatt hours. May be estim
ated by integrating power samples or may<br> | |
194 # be exact on supported hardwar
e.<br> | |
195 'energy_consumption_mwh': mwh,<br> | |
196 <br> | |
197 # The target application's energy&nb
sp;consumption during the sampling period<br> | |
198 # in milliwatt hours. Should be
returned iff<br> | |
199 # <a href="#Platform-CanMeasurePerApplicationPower"
>CanMeasurePerApplicationPower</a>() return true.<br> | |
200 'application_energy_consumption_mwh': mwh,<br> | |
201 <br> | |
202 # A platform-specific dictionary of&
nbsp;additional details about the<br> | |
203 # utilization of individual hardware
components.<br> | |
204 component_utilization: {<br> | |
205 ...<br> | |
206 }<br> | |
207 # <a href="#Platform">Platform</a>-specific da
ta not attributed to any particular hardware<br> | |
208 # component.<br> | |
209 platform_info: {<br> | |
210 <br> | |
211 # Device-specific onboard tem
perature sensor.<br> | |
212 'average_temperature_c': c,<br> | |
213 <br> | |
214 ...<br> | |
215 }<br> | |
216 <br> | |
217 }</tt></dd></dl> | |
218 | |
219 <dl><dt><a name="Platform-StopVideoCapture"><strong>StopVideoCapture</strong></a
>(self)</dt><dd><tt>Stops capturing video.<br> | |
220 <br> | |
221 Returns:<br> | |
222 A telemetry.core.video.Video <a href="__builtin__.html#obj
ect">object</a>.</tt></dd></dl> | |
223 | |
224 <dl><dt><a name="Platform-TakeScreenshot"><strong>TakeScreenshot</strong></a>(se
lf, file_path)</dt><dd><tt>Takes a screenshot of the pl
atform and save to |file_path|.<br> | |
225 <br> | |
226 Note that this method may not be supported&nb
sp;on all platform, so check with<br> | |
227 CanTakeScreenshot before calling this.<br> | |
228 <br> | |
229 Args:<br> | |
230 file_path: Where to save the screenshot&nbs
p;to. If the platform is remote,<br> | |
231 |file_path| is the path on the&
nbsp;host platform.<br> | |
232 <br> | |
233 Returns True if it is believed the attempt&nb
sp;succeeded.</tt></dd></dl> | |
234 | |
235 <dl><dt><a name="Platform-__init__"><strong>__init__</strong></a>(self, platform
_backend)</dt></dl> | |
236 | |
237 <hr> | |
238 Data descriptors defined here:<br> | |
239 <dl><dt><strong>__dict__</strong></dt> | |
240 <dd><tt>dictionary for instance variables (if defined)<
/tt></dd> | |
241 </dl> | |
242 <dl><dt><strong>__weakref__</strong></dt> | |
243 <dd><tt>list of weak references to the object 
;(if defined)</tt></dd> | |
244 </dl> | |
245 <dl><dt><strong>http_server</strong></dt> | |
246 </dl> | |
247 <dl><dt><strong>is_host_platform</strong></dt> | |
248 </dl> | |
249 <dl><dt><strong>local_servers</strong></dt> | |
250 <dd><tt>Returns the currently running local servers.</t
t></dd> | |
251 </dl> | |
252 <dl><dt><strong>network_controller</strong></dt> | |
253 <dd><tt>Control network settings and servers to si
mulate the Web.</tt></dd> | |
254 </dl> | |
255 <dl><dt><strong>tracing_controller</strong></dt> | |
256 </dl> | |
257 </td></tr></table></td></tr></table><p> | |
258 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> | |
259 <tr bgcolor="#eeaa77"> | |
260 <td colspan=3 valign=bottom> <br> | |
261 <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></b
ig></font></td></tr> | |
262 | |
263 <tr><td bgcolor="#eeaa77"><tt> </tt></td><td>
</td> | |
264 <td width="100%"><dl><dt><a name="-GetHostPlatform"><strong>GetHostPlatform</str
ong></a>()</dt></dl> | |
265 <dl><dt><a name="-GetPlatformForDevice"><strong>GetPlatformForDevice</strong></
a>(device, finder_options, logging<font color="#909090">=<module 'logging' fr
om '/usr/lib/python2.7/logging/__init__.pyc'></font>)</dt><dd><tt>Returns&nbs
p;a platform instance for the device.<br> | |
266 Args:<br> | |
267 device: a device.Device instance.</tt></dd></dl> | |
268 </td></tr></table> | |
269 </body></html> | |
OLD | NEW |