telemetry.internal.platform.power_monitor.cros_power_monitor
index
telemetry/internal/platform/power_monitor/cros_power_monitor.py

# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

 
Modules
       
collections
telemetry.decorators
re
telemetry.internal.platform.power_monitor.sysfs_power_monitor

 
Classes
       
telemetry.internal.platform.power_monitor.sysfs_power_monitor.SysfsPowerMonitor(telemetry.internal.platform.power_monitor.PowerMonitor)
CrosPowerMonitor

 
class CrosPowerMonitor(telemetry.internal.platform.power_monitor.sysfs_power_monitor.SysfsPowerMonitor)
    PowerMonitor that relies on 'dump_power_status' to monitor power
consumption of a single ChromeOS application.
 
 
Method resolution order:
CrosPowerMonitor
telemetry.internal.platform.power_monitor.sysfs_power_monitor.SysfsPowerMonitor
telemetry.internal.platform.power_monitor.PowerMonitor
__builtin__.object

Methods defined here:
CanMonitorPower(*args, **kwargs)
StartMonitoringPower(self, browser)
StopMonitoringPower(self)
__init__(self, platform_backend)
Constructor.
 
Args:
    platform_backend: A LinuxBasedPlatformBackend object.
 
Attributes:
    _initial_power: The result of 'dump_power_status' before the test.
    _start_time: The epoch time at which the test starts executing.

Static methods defined here:
IsOnBatteryPower(status, board)
Determines if the devices is being charged.
 
Args:
    status: The parsed result of 'dump_power_status'
    board: The name of the board running the test.
 
Returns:
    True if the device is on battery power; False otherwise.
ParsePower(initial_stats, final_stats, length_h)
Parse output of 'dump_power_status'
 
Args:
    initial_stats: The output of 'dump_power_status' before the test.
    final_stats: The output of 'dump_power_status' after the test.
    length_h: The length of the test in hours.
 
Returns:
    Dictionary in the format returned by StopMonitoringPower().
ParsePowerStatus(sample)
Parses 'dump_power_status' command output.
 
Args:
    sample: The output of 'dump_power_status'
 
Returns:
    Dictionary containing all fields from 'dump_power_status'
SplitSample(sample)
Splits a power and time sample into the two separate values.
 
Args:
    sample: The result of calling 'dump_power_status; date +%s' on the
        device.
 
Returns:
    A tuple of power sample and epoch time of the sample.

Methods inherited from telemetry.internal.platform.power_monitor.sysfs_power_monitor.SysfsPowerMonitor:
GetCpuFreq(self)
Retrieve CPU frequency times from the device.
 
Returns:
    Dictionary containing frequency times for each CPU.
GetCpuState(self)
Retrieve CPU c-state residency times from the device.
 
Returns:
    Dictionary containing c-state residency times for each CPU.

Static methods inherited from telemetry.internal.platform.power_monitor.sysfs_power_monitor.SysfsPowerMonitor:
CombineResults(cpu_stats, power_stats)
Add frequency and c-state residency data to the power data.
 
Args:
    cpu_stats: Dictionary containing CPU statistics.
    power_stats: Dictionary containing power statistics.
 
Returns:
    Dictionary in the format returned by StopMonitoringPower.
ComputeCpuStats(initial, final)
Parse the CPU c-state and frequency values saved during monitoring.
 
Args:
    initial: The parsed dictionary of initial statistics to be converted
    into percentages.
    final: The parsed dictionary of final statistics to be converted
    into percentages.
 
Returns:
    Dictionary containing percentages for each CPU as well as an average
    across all CPUs.
ParseFreqSample(sample)
Parse a single frequency sample.
 
Args:
    sample: The single sample of frequency data to be parsed.
 
Returns:
    A dictionary associating a frequency with a time.

Methods inherited from telemetry.internal.platform.power_monitor.PowerMonitor:
CanMeasurePerApplicationPower(self)
Returns True if the power monitor can measure power for the target
application in isolation. False if power measurement is for full system
energy consumption.

Data descriptors inherited from telemetry.internal.platform.power_monitor.PowerMonitor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)