| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><title>Python: module telemetry.core.platform</title> |
| <meta charset="utf-8"> |
| </head><body bgcolor="#f0f0f8"> |
| |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| <tr bgcolor="#7799ee"> |
| <td valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="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 |
| ><td align=right valign=bottom |
| ><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> |
| <p><tt># Copyright 2012 The Chromium Authors. All rights reserved.<br> |
| # Use of this source code is governed by a BSD-style license that can be<br> |
| # found in the LICENSE file.</tt></p> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#aa55cc"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.core.discover.html">telemetry.core.discover</a><br> |
| <a href="telemetry.core.local_server.html">telemetry.core.local_server</a><br> |
| <a href="telemetry.core.memory_cache_http_server.html">telemetry.core.memory_cache_http_server</a><br> |
| </td><td width="25%" valign=top><a href="telemetry.core.network_controller.html">telemetry.core.network_controller</a><br> |
| <a href="os.html">os</a><br> |
| <a href="telemetry.internal.platform.platform_backend.html">telemetry.internal.platform.platform_backend</a><br> |
| </td><td width="25%" valign=top><a href="logging.html">logging</a><br> |
| <a href="telemetry.core.tracing_controller.html">telemetry.core.tracing_controller</a><br> |
| <a href="telemetry.core.util.html">telemetry.core.util</a><br> |
| </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ee77aa"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| <td width="100%"><dl> |
| <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| </font></dt><dd> |
| <dl> |
| <dt><font face="helvetica, arial"><a href="telemetry.core.platform.html#Platform">Platform</a> |
| </font></dt></dl> |
| </dd> |
| </dl> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ffc8d8"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#000000" face="helvetica, arial"><a name="Platform">class <strong>Platform</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| |
| <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| <td colspan=2><tt>The platform that the target browser is running on.<br> |
| <br> |
| Provides a limited interface to interact with the platform itself, where<br> |
| possible. It's important to note that platforms may not provide a specific<br> |
| API, so check with IsFooBar() for availability.<br> </tt></td></tr> |
| <tr><td> </td> |
| <td width="100%">Methods defined here:<br> |
| <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> |
| |
| <dl><dt><a name="Platform-CanFlushIndividualFilesFromSystemCache"><strong>CanFlushIndividualFilesFromSystemCache</strong></a>(self)</dt><dd><tt>Returns true if the disk cache can be flushed for specific files.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanLaunchApplication"><strong>CanLaunchApplication</strong></a>(self, application)</dt><dd><tt>Returns whether the platform can launch the given application.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanMeasurePerApplicationPower"><strong>CanMeasurePerApplicationPower</strong></a>(self)</dt><dd><tt>Returns True if the power monitor can measure power for the target<br> |
| application in isolation. False if power measurement is for full system<br> |
| energy consumption.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanMonitorNetworkData"><strong>CanMonitorNetworkData</strong></a>(self)</dt><dd><tt>Returns true if network data can be retrieved, false otherwise.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanMonitorPower"><strong>CanMonitorPower</strong></a>(self)</dt><dd><tt>Returns True iff power can be monitored asynchronously via<br> |
| <a href="#Platform-StartMonitoringPower">StartMonitoringPower</a>() and <a href="#Platform-StopMonitoringPower">StopMonitoringPower</a>().</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanMonitorThermalThrottling"><strong>CanMonitorThermalThrottling</strong></a>(self)</dt><dd><tt>Platforms may be able to detect thermal throttling.<br> |
| <br> |
| Some fan-less computers go into a reduced performance mode when their heat<br> |
| exceeds a certain threshold. Performance tests in particular should use this<br> |
| API to detect if this has happened and interpret results accordingly.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-CanTakeScreenshot"><strong>CanTakeScreenshot</strong></a>(self)</dt></dl> |
| |
| <dl><dt><a name="Platform-CooperativelyShutdown"><strong>CooperativelyShutdown</strong></a>(self, proc, app_name)</dt><dd><tt>Cooperatively shut down the given process from subprocess.Popen.<br> |
| <br> |
| Currently this is only implemented on Windows. See<br> |
| crbug.com/424024 for background on why it was added.<br> |
| <br> |
| Args:<br> |
| proc: a process <a href="__builtin__.html#object">object</a> returned from subprocess.Popen.<br> |
| app_name: on Windows, is the prefix of the application's window<br> |
| class name that should be searched for. This helps ensure<br> |
| that only the application's windows are closed.<br> |
| <br> |
| Returns True if it is believed the attempt succeeded.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-FlushDnsCache"><strong>FlushDnsCache</strong></a>(self)</dt><dd><tt>Flushes the OS's DNS cache completely.<br> |
| <br> |
| This function may require root or administrator access.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-FlushEntireSystemCache"><strong>FlushEntireSystemCache</strong></a>(self)</dt><dd><tt>Flushes the OS's file cache completely.<br> |
| <br> |
| This function may require root or administrator access.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-FlushSystemCacheForDirectory"><strong>FlushSystemCacheForDirectory</strong></a>(self, directory)</dt><dd><tt>Flushes the OS's file cache for the specified directory.<br> |
| <br> |
| This function does not require root or administrator access.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetArchName"><strong>GetArchName</strong></a>(self)</dt><dd><tt>Returns a string description of the <a href="#Platform">Platform</a> architecture.<br> |
| <br> |
| Examples: x86_64 (posix), AMD64 (win), armeabi-v7a, x86</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetDeviceTypeName"><strong>GetDeviceTypeName</strong></a>(self)</dt><dd><tt>Returns a string description of the <a href="#Platform">Platform</a> device, or None.<br> |
| <br> |
| Examples: Nexus 7, Nexus 6, Desktop</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetNetworkData"><strong>GetNetworkData</strong></a>(self, browser)</dt><dd><tt>Get current network data.<br> |
| Returns:<br> |
| Tuple of (sent_data, received_data) in kb if data can be found,<br> |
| None otherwise.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetOSName"><strong>GetOSName</strong></a>(self)</dt><dd><tt>Returns a string description of the <a href="#Platform">Platform</a> OS.<br> |
| <br> |
| Examples: WIN, MAC, LINUX, CHROMEOS</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetOSVersionName"><strong>GetOSVersionName</strong></a>(self)</dt><dd><tt>Returns a logically sortable, string-like description of the <a href="#Platform">Platform</a> OS<br> |
| version.<br> |
| <br> |
| Examples: VISTA, WIN7, LION, MOUNTAINLION</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-GetOSVersionNumber"><strong>GetOSVersionNumber</strong></a>(self)</dt><dd><tt>Returns an integer description of the <a href="#Platform">Platform</a> OS major version.<br> |
| <br> |
| Examples: On Mac, 13 for Mavericks, 14 for Yosemite.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-HasBeenThermallyThrottled"><strong>HasBeenThermallyThrottled</strong></a>(self)</dt><dd><tt>Returns True if the device has been thermally throttled.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-InstallApplication"><strong>InstallApplication</strong></a>(self, application)</dt><dd><tt>Installs the given application.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-IsApplicationRunning"><strong>IsApplicationRunning</strong></a>(self, application)</dt><dd><tt>Returns whether an application is currently running.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-IsCooperativeShutdownSupported"><strong>IsCooperativeShutdownSupported</strong></a>(self)</dt><dd><tt>Indicates whether CooperativelyShutdown, below, is supported.<br> |
| It is not necessary to implement it on all platforms.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-IsMonitoringPower"><strong>IsMonitoringPower</strong></a>(self)</dt><dd><tt>Returns true if power is currently being monitored, false otherwise.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-IsThermallyThrottled"><strong>IsThermallyThrottled</strong></a>(self)</dt><dd><tt>Returns True if the device is currently thermally throttled.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-LaunchApplication"><strong>LaunchApplication</strong></a>(self, application, parameters<font color="#909090">=None</font>, elevate_privilege<font color="#909090">=False</font>)</dt><dd><tt>"Launches the given |application| with a list of |parameters| on the OS.<br> |
| <br> |
| Set |elevate_privilege| to launch the application with root or admin rights.<br> |
| <br> |
| Returns:<br> |
| A popen style process handle for host platforms.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-SetHTTPServerDirectories"><strong>SetHTTPServerDirectories</strong></a>(self, paths)</dt><dd><tt>Returns True if the HTTP server was started, False otherwise.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-StartLocalServer"><strong>StartLocalServer</strong></a>(self, server)</dt><dd><tt>Starts a LocalServer and associates it with this platform.<br> |
| |server.Close()| should be called manually to close the started server.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-StartMonitoringPower"><strong>StartMonitoringPower</strong></a>(self, browser)</dt><dd><tt>Starts monitoring power utilization statistics.<br> |
| <br> |
| Args:<br> |
| browser: The browser to monitor.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-StartVideoCapture"><strong>StartVideoCapture</strong></a>(self, min_bitrate_mbps)</dt><dd><tt>Starts capturing video.<br> |
| <br> |
| Outer framing may be included (from the OS, browser window, and webcam).<br> |
| <br> |
| Args:<br> |
| min_bitrate_mbps: The minimum capture bitrate in MegaBits Per Second.<br> |
| The platform is free to deliver a higher bitrate if it can do so<br> |
| without increasing overhead.<br> |
| <br> |
| Raises:<br> |
| ValueError if the required |min_bitrate_mbps| can't be achieved.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-StopAllLocalServers"><strong>StopAllLocalServers</strong></a>(self)</dt></dl> |
| |
| <dl><dt><a name="Platform-StopMonitoringPower"><strong>StopMonitoringPower</strong></a>(self)</dt><dd><tt>Stops monitoring power utilization and returns stats<br> |
| <br> |
| Returns:<br> |
| None if power measurement failed for some reason, otherwise a dict of<br> |
| power utilization statistics containing: {<br> |
| # An identifier for the data provider. Allows to evaluate the precision<br> |
| # of the data. Example values: monsoon, powermetrics, ds2784<br> |
| 'identifier': identifier,<br> |
| <br> |
| # The instantaneous power (voltage * current) reading in milliwatts at<br> |
| # each sample.<br> |
| 'power_samples_mw': [mw0, mw1, ..., mwN],<br> |
| <br> |
| # The full system energy consumption during the sampling period in<br> |
| # milliwatt hours. May be estimated by integrating power samples or may<br> |
| # be exact on supported hardware.<br> |
| 'energy_consumption_mwh': mwh,<br> |
| <br> |
| # The target application's energy consumption during the sampling period<br> |
| # in milliwatt hours. Should be returned iff<br> |
| # <a href="#Platform-CanMeasurePerApplicationPower">CanMeasurePerApplicationPower</a>() return true.<br> |
| 'application_energy_consumption_mwh': mwh,<br> |
| <br> |
| # A platform-specific dictionary of additional details about the<br> |
| # utilization of individual hardware components.<br> |
| component_utilization: {<br> |
| ...<br> |
| }<br> |
| # <a href="#Platform">Platform</a>-specific data not attributed to any particular hardware<br> |
| # component.<br> |
| platform_info: {<br> |
| <br> |
| # Device-specific onboard temperature sensor.<br> |
| 'average_temperature_c': c,<br> |
| <br> |
| ...<br> |
| }<br> |
| <br> |
| }</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-StopVideoCapture"><strong>StopVideoCapture</strong></a>(self)</dt><dd><tt>Stops capturing video.<br> |
| <br> |
| Returns:<br> |
| A telemetry.core.video.Video <a href="__builtin__.html#object">object</a>.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-TakeScreenshot"><strong>TakeScreenshot</strong></a>(self, file_path)</dt><dd><tt>Takes a screenshot of the platform and save to |file_path|.<br> |
| <br> |
| Note that this method may not be supported on all platform, so check with<br> |
| CanTakeScreenshot before calling this.<br> |
| <br> |
| Args:<br> |
| file_path: Where to save the screenshot to. If the platform is remote,<br> |
| |file_path| is the path on the host platform.<br> |
| <br> |
| Returns True if it is believed the attempt succeeded.</tt></dd></dl> |
| |
| <dl><dt><a name="Platform-__init__"><strong>__init__</strong></a>(self, platform_backend)</dt></dl> |
| |
| <hr> |
| Data descriptors defined here:<br> |
| <dl><dt><strong>__dict__</strong></dt> |
| <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| </dl> |
| <dl><dt><strong>__weakref__</strong></dt> |
| <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| </dl> |
| <dl><dt><strong>http_server</strong></dt> |
| </dl> |
| <dl><dt><strong>is_host_platform</strong></dt> |
| </dl> |
| <dl><dt><strong>local_servers</strong></dt> |
| <dd><tt>Returns the currently running local servers.</tt></dd> |
| </dl> |
| <dl><dt><strong>network_controller</strong></dt> |
| <dd><tt>Control network settings and servers to simulate the Web.</tt></dd> |
| </dl> |
| <dl><dt><strong>tracing_controller</strong></dt> |
| </dl> |
| </td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#eeaa77"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| <td width="100%"><dl><dt><a name="-GetHostPlatform"><strong>GetHostPlatform</strong></a>()</dt></dl> |
| <dl><dt><a name="-GetPlatformForDevice"><strong>GetPlatformForDevice</strong></a>(device, finder_options, logging<font color="#909090">=<module 'logging' from '/usr/lib/python2.7/logging/__init__.pyc'></font>)</dt><dd><tt>Returns a platform instance for the device.<br> |
| Args:<br> |
| device: a device.Device instance.</tt></dd></dl> |
| </td></tr></table> |
| </body></html> |