2 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
3 <html><head><title>Python: module telemetry.internal.platform.linux_based_platform_backend
</title>
5 </head><body bgcolor=
"#f0f0f8">
7 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"heading">
9 <td valign=bottom
> <br>
10 <font color=
"#ffffff" face=
"helvetica, arial"> <br><big><big><strong><a href=
"telemetry.html"><font color=
"#ffffff">telemetry
</font></a>.
<a href=
"telemetry.internal.html"><font color=
"#ffffff">internal
</font></a>.
<a href=
"telemetry.internal.platform.html"><font color=
"#ffffff">platform
</font></a>.linux_based_platform_backend
</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/internal/platform/linux_based_platform_backend.py">telemetry/internal/platform/linux_based_platform_backend.py
</a></font></td></tr></table>
13 <p><tt>#
Copyright
2013 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>
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>
22 <tr><td bgcolor=
"#aa55cc"><tt> </tt></td><td> </td>
23 <td width=
"100%"><table width=
"100%" summary=
"list"><tr><td width=
"25%" valign=top
><a href=
"telemetry.decorators.html">telemetry.decorators
</a><br>
24 <a href=
"telemetry.core.exceptions.html">telemetry.core.exceptions
</a><br>
25 </td><td width=
"25%" valign=top
><a href=
"telemetry.internal.platform.platform_backend.html">telemetry.internal.platform.platform_backend
</a><br>
26 <a href=
"re.html">re
</a><br>
27 </td><td width=
"25%" valign=top
><a href=
"resource.html">resource
</a><br>
28 </td><td width=
"25%" valign=top
></td></tr></table></td></tr></table><p>
29 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
30 <tr bgcolor=
"#ee77aa">
31 <td colspan=
3 valign=bottom
> <br>
32 <font color=
"#ffffff" face=
"helvetica, arial"><big><strong>Classes
</strong></big></font></td></tr>
34 <tr><td bgcolor=
"#ee77aa"><tt> </tt></td><td> </td>
36 <dt><font face=
"helvetica, arial"><a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a>(
<a href=
"__builtin__.html#object">__builtin__.object
</a>)
39 <dt><font face=
"helvetica, arial"><a href=
"telemetry.internal.platform.linux_based_platform_backend.html#LinuxBasedPlatformBackend">LinuxBasedPlatformBackend
</a>
44 <table width=
"100%" cellspacing=
0 cellpadding=
2 border=
0 summary=
"section">
45 <tr bgcolor=
"#ffc8d8">
46 <td colspan=
3 valign=bottom
> <br>
47 <font color=
"#000000" face=
"helvetica, arial"><a name=
"LinuxBasedPlatformBackend">class
<strong>LinuxBasedPlatformBackend
</strong></a>(
<a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a>)
</font></td></tr>
49 <tr bgcolor=
"#ffc8d8"><td rowspan=
2><tt> </tt></td>
50 <td colspan=
2><tt>Abstract
platform
containing
functionality
shared
by
all
Linux
based
OSes.
<br>
52 This
includes
Android
and
ChromeOS.
<br>
54 Subclasses
must
implement
RunCommand,
GetFileContents,
GetPsOutput,
and
<br>
55 ParseCStateSample.
<br> </tt></td></tr>
57 <td width=
"100%"><dl><dt>Method resolution order:
</dt>
58 <dd><a href=
"telemetry.internal.platform.linux_based_platform_backend.html#LinuxBasedPlatformBackend">LinuxBasedPlatformBackend
</a></dd>
59 <dd><a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a></dd>
60 <dd><a href=
"__builtin__.html#object">__builtin__.object
</a></dd>
63 Methods defined here:
<br>
64 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetClockTicks"><strong>GetClockTicks
</strong></a>(*args, **kwargs)
</dt><dd><tt>Returns
the
number
of
clock
ticks
per
second.
<br>
66 The
proper
way
is
to
call
os.sysconf('SC_CLK_TCK')
but
that
is
not
easy
to
<br>
67 do
on
Android/CrOS.
In
practice,
nearly
all
Linux
machines
have
a
USER_HZ
<br>
68 of
100,
so
just
return
that.
</tt></dd></dl>
70 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetCpuStats"><strong>GetCpuStats
</strong></a>(self, pid)
</dt></dl>
72 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetCpuTimestamp"><strong>GetCpuTimestamp
</strong></a>(self)
</dt></dl>
74 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetFileContents"><strong>GetFileContents
</strong></a>(self, filename)
</dt></dl>
76 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetMemoryStats"><strong>GetMemoryStats
</strong></a>(self, pid)
</dt></dl>
78 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetPsOutput"><strong>GetPsOutput
</strong></a>(self, columns, pid
<font color=
"#909090">=None
</font>)
</dt></dl>
80 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetSystemCommitCharge"><strong>GetSystemCommitCharge
</strong></a>(self)
</dt><dd><tt>#
Get
the
commit
charge
in
kB.
</tt></dd></dl>
82 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetSystemTotalPhysicalMemory"><strong>GetSystemTotalPhysicalMemory
</strong></a>(*args, **kwargs)
</dt></dl>
84 <dl><dt><a name=
"LinuxBasedPlatformBackend-RunCommand"><strong>RunCommand
</strong></a>(self, cmd)
</dt><dd><tt>Runs
the
specified
command.
<br>
87 cmd:
A
list
of
program
arguments
or
the
path
string
of
the
program.
<br>
89 A
string
whose
content
is
the
output
of
the
command.
</tt></dd></dl>
92 Static methods defined here:
<br>
93 <dl><dt><a name=
"LinuxBasedPlatformBackend-ParseCStateSample"><strong>ParseCStateSample
</strong></a>(sample)
</dt><dd><tt>Parse
a
single
c-state
residency
sample.
<br>
95 Args:
<br>
96 sample:
A
sample
of
c-state
residency
times
to
be
parsed.
Organized
as
<br>
97 a
dictionary
mapping
CPU
name
to
a
string
containing
all
c-state
<br>
98 names,
the
times
in
each
state,
the
latency
of
each
state,
and
the
<br>
99 time
at
which
the
sample
was
taken
all
separated
by
newlines.
<br>
100 Ex:
{'cpu0':
'C0
<br>
108 Returns:
<br>
109 Dictionary
associating
a
c-state
with
a
time.
</tt></dd></dl>
112 Methods inherited from
<a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a>:
<br>
113 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanCaptureVideo"><strong>CanCaptureVideo
</strong></a>(self)
</dt></dl>
115 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanFlushIndividualFilesFromSystemCache"><strong>CanFlushIndividualFilesFromSystemCache
</strong></a>(self)
</dt></dl>
117 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanLaunchApplication"><strong>CanLaunchApplication
</strong></a>(self, application)
</dt></dl>
119 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanMeasurePerApplicationPower"><strong>CanMeasurePerApplicationPower
</strong></a>(self)
</dt></dl>
121 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanMonitorNetworkData"><strong>CanMonitorNetworkData
</strong></a>(self)
</dt></dl>
123 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanMonitorPower"><strong>CanMonitorPower
</strong></a>(self)
</dt></dl>
125 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanMonitorThermalThrottling"><strong>CanMonitorThermalThrottling
</strong></a>(self)
</dt></dl>
127 <dl><dt><a name=
"LinuxBasedPlatformBackend-CanTakeScreenshot"><strong>CanTakeScreenshot
</strong></a>(self)
</dt></dl>
129 <dl><dt><a name=
"LinuxBasedPlatformBackend-CooperativelyShutdown"><strong>CooperativelyShutdown
</strong></a>(self, proc, app_name)
</dt><dd><tt>Cooperatively
shut
down
the
given
process
from
subprocess.Popen.
<br>
131 Currently
this
is
only
implemented
on
Windows.
See
<br>
132 crbug.com/
424024 for
background
on
why
it
was
added.
<br>
135 proc:
a
process
object
returned
from
subprocess.Popen.
<br>
136 app_name:
on
Windows,
is
the
prefix
of
the
application's
window
<br>
137 class
name
that
should
be
searched
for.
This
helps
ensure
<br>
138 that
only
the
application's
windows
are
closed.
<br>
140 Returns
True
if
it
is
believed
the
attempt
succeeded.
</tt></dd></dl>
142 <dl><dt><a name=
"LinuxBasedPlatformBackend-DidCreateBrowser"><strong>DidCreateBrowser
</strong></a>(self, browser, browser_backend)
</dt></dl>
144 <dl><dt><a name=
"LinuxBasedPlatformBackend-DidStartBrowser"><strong>DidStartBrowser
</strong></a>(self, browser, browser_backend)
</dt></dl>
146 <dl><dt><a name=
"LinuxBasedPlatformBackend-FlushDnsCache"><strong>FlushDnsCache
</strong></a>(self)
</dt></dl>
148 <dl><dt><a name=
"LinuxBasedPlatformBackend-FlushEntireSystemCache"><strong>FlushEntireSystemCache
</strong></a>(self)
</dt></dl>
150 <dl><dt><a name=
"LinuxBasedPlatformBackend-FlushSystemCacheForDirectory"><strong>FlushSystemCacheForDirectory
</strong></a>(self, directory)
</dt></dl>
152 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetArchName"><strong>GetArchName
</strong></a>(self)
</dt></dl>
154 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetChildPids"><strong>GetChildPids
</strong></a>(self, pid)
</dt></dl>
156 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetCommandLine"><strong>GetCommandLine
</strong></a>(self, pid)
</dt></dl>
158 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetDeviceTypeName"><strong>GetDeviceTypeName
</strong></a>(self)
</dt></dl>
160 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetNetworkData"><strong>GetNetworkData
</strong></a>(self, browser)
</dt></dl>
162 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetOSName"><strong>GetOSName
</strong></a>(self)
</dt></dl>
164 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetOSVersionName"><strong>GetOSVersionName
</strong></a>(self)
</dt></dl>
166 <dl><dt><a name=
"LinuxBasedPlatformBackend-GetRemotePort"><strong>GetRemotePort
</strong></a>(self, port)
</dt></dl>
168 <dl><dt><a name=
"LinuxBasedPlatformBackend-HasBeenThermallyThrottled"><strong>HasBeenThermallyThrottled
</strong></a>(self)
</dt></dl>
170 <dl><dt><a name=
"LinuxBasedPlatformBackend-InitPlatformBackend"><strong>InitPlatformBackend
</strong></a>(self)
</dt></dl>
172 <dl><dt><a name=
"LinuxBasedPlatformBackend-InstallApplication"><strong>InstallApplication
</strong></a>(self, application)
</dt></dl>
174 <dl><dt><a name=
"LinuxBasedPlatformBackend-IsApplicationRunning"><strong>IsApplicationRunning
</strong></a>(self, application)
</dt></dl>
176 <dl><dt><a name=
"LinuxBasedPlatformBackend-IsCooperativeShutdownSupported"><strong>IsCooperativeShutdownSupported
</strong></a>(self)
</dt><dd><tt>Indicates
whether
CooperativelyShutdown,
below,
is
supported.
<br>
177 It
is
not
necessary
to
implement
it
on
all
platforms.
</tt></dd></dl>
179 <dl><dt><a name=
"LinuxBasedPlatformBackend-IsDisplayTracingSupported"><strong>IsDisplayTracingSupported
</strong></a>(self)
</dt></dl>
181 <dl><dt><a name=
"LinuxBasedPlatformBackend-IsThermallyThrottled"><strong>IsThermallyThrottled
</strong></a>(self)
</dt></dl>
183 <dl><dt><a name=
"LinuxBasedPlatformBackend-LaunchApplication"><strong>LaunchApplication
</strong></a>(self, application, parameters
<font color=
"#909090">=None
</font>, elevate_privilege
<font color=
"#909090">=False
</font>)
</dt></dl>
185 <dl><dt><a name=
"LinuxBasedPlatformBackend-PathExists"><strong>PathExists
</strong></a>(self, path, timeout
<font color=
"#909090">=None
</font>, retries
<font color=
"#909090">=None
</font>)
</dt><dd><tt>Tests
whether
the
given
path
exists
on
the
target
platform.
<br>
187 path:
path
in
request.
<br>
188 timeout:
timeout.
<br>
189 retries:
num
of
retries.
<br>
191 Whether
the
path
exists
on
the
target
platform.
</tt></dd></dl>
193 <dl><dt><a name=
"LinuxBasedPlatformBackend-PurgeUnpinnedMemory"><strong>PurgeUnpinnedMemory
</strong></a>(self)
</dt></dl>
195 <dl><dt><a name=
"LinuxBasedPlatformBackend-ReadMsr"><strong>ReadMsr
</strong></a>(self, msr_number, start
<font color=
"#909090">=
0</font>, length
<font color=
"#909090">=
64</font>)
</dt><dd><tt>Read
a
CPU
model-specific
register
(MSR).
<br>
197 Which
MSRs
are
available
depends
on
the
CPU
model.
<br>
198 On
systems
with
multiple
CPUs,
this
function
may
run
on
any
CPU.
<br>
201 msr_number:
The
number
of
the
register
to
read.
<br>
202 start:
The
least
significant
bit
to
read,
zero-indexed.
<br>
203 (Said
another
way,
the
number
of
bits
to
right-shift
the
MSR
value.)
<br>
204 length:
The
number
of
bits
to
read.
MSRs
are
64 bits,
even
on
32-bit
CPUs.
</tt></dd></dl>
206 <dl><dt><a name=
"LinuxBasedPlatformBackend-SetFullPerformanceModeEnabled"><strong>SetFullPerformanceModeEnabled
</strong></a>(self, enabled)
</dt></dl>
208 <dl><dt><a name=
"LinuxBasedPlatformBackend-SetPlatform"><strong>SetPlatform
</strong></a>(self, platform)
</dt></dl>
210 <dl><dt><a name=
"LinuxBasedPlatformBackend-StartDisplayTracing"><strong>StartDisplayTracing
</strong></a>(self)
</dt><dd><tt>Start
gathering
a
trace
with
frame
timestamps
close
to
physical
<br>
211 display.
</tt></dd></dl>
213 <dl><dt><a name=
"LinuxBasedPlatformBackend-StartMonitoringPower"><strong>StartMonitoringPower
</strong></a>(self, browser)
</dt></dl>
215 <dl><dt><a name=
"LinuxBasedPlatformBackend-StartVideoCapture"><strong>StartVideoCapture
</strong></a>(self, min_bitrate_mbps)
</dt></dl>
217 <dl><dt><a name=
"LinuxBasedPlatformBackend-StopDisplayTracing"><strong>StopDisplayTracing
</strong></a>(self)
</dt><dd><tt>Stop
gathering
a
trace
with
frame
timestamps
close
to
physical
display.
<br>
219 Returns
a
raw
tracing
events
that
contains
the
timestamps
of
physical
<br>
220 display.
</tt></dd></dl>
222 <dl><dt><a name=
"LinuxBasedPlatformBackend-StopMonitoringPower"><strong>StopMonitoringPower
</strong></a>(self)
</dt></dl>
224 <dl><dt><a name=
"LinuxBasedPlatformBackend-StopVideoCapture"><strong>StopVideoCapture
</strong></a>(self)
</dt></dl>
226 <dl><dt><a name=
"LinuxBasedPlatformBackend-TakeScreenshot"><strong>TakeScreenshot
</strong></a>(self, file_path)
</dt></dl>
228 <dl><dt><a name=
"LinuxBasedPlatformBackend-WillCloseBrowser"><strong>WillCloseBrowser
</strong></a>(self, browser, browser_backend)
</dt></dl>
230 <dl><dt><a name=
"LinuxBasedPlatformBackend-__init__"><strong>__init__
</strong></a>(self, device
<font color=
"#909090">=None
</font>)
</dt><dd><tt>Initalize
an
instance
of
<a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">PlatformBackend
</a> from
a
device
optionally.
<br>
231 Call
sites
need
to
use
SupportsDevice
before
intialization
to
check
<br>
232 whether
this
platform
backend
supports
the
device.
<br>
233 If
device
is
None,
this
constructor
returns
the
host
platform
backend
<br>
234 which
telemetry
is
running
on.
<br>
237 device:
an
instance
of
telemetry.core.platform.device.Device.
</tt></dd></dl>
240 Class methods inherited from
<a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a>:
<br>
241 <dl><dt><a name=
"LinuxBasedPlatformBackend-CreatePlatformForDevice"><strong>CreatePlatformForDevice
</strong></a>(cls, device, finder_options)
<font color=
"#909090"><font face=
"helvetica, arial"> from
<a href=
"__builtin__.html#type">__builtin__.type
</a></font></font></dt></dl>
243 <dl><dt><a name=
"LinuxBasedPlatformBackend-IsPlatformBackendForHost"><strong>IsPlatformBackendForHost
</strong></a>(cls)
<font color=
"#909090"><font face=
"helvetica, arial"> from
<a href=
"__builtin__.html#type">__builtin__.type
</a></font></font></dt><dd><tt>Returns
whether
this
platform
backend
is
the
platform
backend
to
be
used
<br>
244 for
the
host
device
which
telemetry
is
running
on.
</tt></dd></dl>
246 <dl><dt><a name=
"LinuxBasedPlatformBackend-SupportsDevice"><strong>SupportsDevice
</strong></a>(cls, device)
<font color=
"#909090"><font face=
"helvetica, arial"> from
<a href=
"__builtin__.html#type">__builtin__.type
</a></font></font></dt><dd><tt>Returns
whether
this
platform
backend
supports
intialization
from
the
<br>
247 device.
</tt></dd></dl>
250 Data descriptors inherited from
<a href=
"telemetry.internal.platform.platform_backend.html#PlatformBackend">telemetry.internal.platform.platform_backend.PlatformBackend
</a>:
<br>
251 <dl><dt><strong>__dict__
</strong></dt>
252 <dd><tt>dictionary
for
instance
variables
(if
defined)
</tt></dd>
254 <dl><dt><strong>__weakref__
</strong></dt>
255 <dd><tt>list
of
weak
references
to
the
object
(if
defined)
</tt></dd>
257 <dl><dt><strong>forwarder_factory
</strong></dt>
259 <dl><dt><strong>is_host_platform
</strong></dt>
261 <dl><dt><strong>is_video_capture_running
</strong></dt>
263 <dl><dt><strong>network_controller_backend
</strong></dt>
265 <dl><dt><strong>platform
</strong></dt>
267 <dl><dt><strong>running_browser_backends
</strong></dt>
269 <dl><dt><strong>tracing_controller_backend
</strong></dt>
271 <dl><dt><strong>wpr_ca_cert_path
</strong></dt>
273 <dl><dt><strong>wpr_http_device_port
</strong></dt>
275 <dl><dt><strong>wpr_https_device_port
</strong></dt>
277 </td></tr></table></td></tr></table>