| |
- telemetry.internal.platform.platform_backend.PlatformBackend(__builtin__.object)
-
- LinuxBasedPlatformBackend
class LinuxBasedPlatformBackend(telemetry.internal.platform.platform_backend.PlatformBackend) |
|
Abstract platform containing functionality shared by all Linux based OSes.
This includes Android and ChromeOS.
Subclasses must implement RunCommand, GetFileContents, GetPsOutput, and
ParseCStateSample. |
|
- Method resolution order:
- LinuxBasedPlatformBackend
- telemetry.internal.platform.platform_backend.PlatformBackend
- __builtin__.object
Methods defined here:
- GetClockTicks(*args, **kwargs)
- Returns the number of clock ticks per second.
The proper way is to call os.sysconf('SC_CLK_TCK') but that is not easy to
do on Android/CrOS. In practice, nearly all Linux machines have a USER_HZ
of 100, so just return that.
- GetCpuStats(self, pid)
- GetCpuTimestamp(self)
- GetFileContents(self, filename)
- GetMemoryStats(self, pid)
- GetPsOutput(self, columns, pid=None)
- GetSystemCommitCharge(self)
- # Get the commit charge in kB.
- GetSystemTotalPhysicalMemory(*args, **kwargs)
- RunCommand(self, cmd)
- Runs the specified command.
Args:
cmd: A list of program arguments or the path string of the program.
Returns:
A string whose content is the output of the command.
Static methods defined here:
- ParseCStateSample(sample)
- Parse a single c-state residency sample.
Args:
sample: A sample of c-state residency times to be parsed. Organized as
a dictionary mapping CPU name to a string containing all c-state
names, the times in each state, the latency of each state, and the
time at which the sample was taken all separated by newlines.
Ex: {'cpu0': 'C0
C1
5000
2000
20
30
1406673171'}
Returns:
Dictionary associating a c-state with a time.
Methods inherited from telemetry.internal.platform.platform_backend.PlatformBackend:
- CanCaptureVideo(self)
- CanFlushIndividualFilesFromSystemCache(self)
- CanLaunchApplication(self, application)
- CanMeasurePerApplicationPower(self)
- CanMonitorNetworkData(self)
- CanMonitorPower(self)
- CanMonitorThermalThrottling(self)
- CanTakeScreenshot(self)
- CooperativelyShutdown(self, proc, app_name)
- Cooperatively shut down the given process from subprocess.Popen.
Currently this is only implemented on Windows. See
crbug.com/424024 for background on why it was added.
Args:
proc: a process object returned from subprocess.Popen.
app_name: on Windows, is the prefix of the application's window
class name that should be searched for. This helps ensure
that only the application's windows are closed.
Returns True if it is believed the attempt succeeded.
- DidCreateBrowser(self, browser, browser_backend)
- DidStartBrowser(self, browser, browser_backend)
- FlushDnsCache(self)
- FlushEntireSystemCache(self)
- FlushSystemCacheForDirectory(self, directory)
- GetArchName(self)
- GetChildPids(self, pid)
- GetCommandLine(self, pid)
- GetDeviceTypeName(self)
- GetNetworkData(self, browser)
- GetOSName(self)
- GetOSVersionName(self)
- GetRemotePort(self, port)
- HasBeenThermallyThrottled(self)
- InitPlatformBackend(self)
- InstallApplication(self, application)
- IsApplicationRunning(self, application)
- IsCooperativeShutdownSupported(self)
- Indicates whether CooperativelyShutdown, below, is supported.
It is not necessary to implement it on all platforms.
- IsDisplayTracingSupported(self)
- IsThermallyThrottled(self)
- LaunchApplication(self, application, parameters=None, elevate_privilege=False)
- PathExists(self, path, timeout=None, retries=None)
- Tests whether the given path exists on the target platform.
Args:
path: path in request.
timeout: timeout.
retries: num of retries.
Return:
Whether the path exists on the target platform.
- PurgeUnpinnedMemory(self)
- ReadMsr(self, msr_number, start=0, length=64)
- Read a CPU model-specific register (MSR).
Which MSRs are available depends on the CPU model.
On systems with multiple CPUs, this function may run on any CPU.
Args:
msr_number: The number of the register to read.
start: The least significant bit to read, zero-indexed.
(Said another way, the number of bits to right-shift the MSR value.)
length: The number of bits to read. MSRs are 64 bits, even on 32-bit CPUs.
- SetFullPerformanceModeEnabled(self, enabled)
- SetPlatform(self, platform)
- StartDisplayTracing(self)
- Start gathering a trace with frame timestamps close to physical
display.
- StartMonitoringPower(self, browser)
- StartVideoCapture(self, min_bitrate_mbps)
- StopDisplayTracing(self)
- Stop gathering a trace with frame timestamps close to physical display.
Returns a raw tracing events that contains the timestamps of physical
display.
- StopMonitoringPower(self)
- StopVideoCapture(self)
- TakeScreenshot(self, file_path)
- WillCloseBrowser(self, browser, browser_backend)
- __init__(self, device=None)
- Initalize an instance of PlatformBackend from a device optionally.
Call sites need to use SupportsDevice before intialization to check
whether this platform backend supports the device.
If device is None, this constructor returns the host platform backend
which telemetry is running on.
Args:
device: an instance of telemetry.core.platform.device.Device.
Class methods inherited from telemetry.internal.platform.platform_backend.PlatformBackend:
- CreatePlatformForDevice(cls, device, finder_options) from __builtin__.type
- IsPlatformBackendForHost(cls) from __builtin__.type
- Returns whether this platform backend is the platform backend to be used
for the host device which telemetry is running on.
- SupportsDevice(cls, device) from __builtin__.type
- Returns whether this platform backend supports intialization from the
device.
Data descriptors inherited from telemetry.internal.platform.platform_backend.PlatformBackend:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- forwarder_factory
- is_host_platform
- is_video_capture_running
- network_controller_backend
- platform
- running_browser_backends
- tracing_controller_backend
- wpr_ca_cert_path
- wpr_http_device_port
- wpr_https_device_port
| |