lisa.energy_model.LegacyEnergyModel#

class lisa.energy_model.LegacyEnergyModel(root_node, root_power_domain, freq_domains)[source]#

Bases: EnergyModel

Legacy energy model used on Android kernels prior 4.19.

The energy model information is stored in sysfs and contains detailed information about idle states.

Warning

Arbitrary code can be executed while loading an instance from a YAML or Pickle file. To include untrusted data in YAML, use the !untrusted tag along with a string

Attributes

ATTRIBUTES_SERIALIZATION inherited

Attributes to be treated specially during serialization.

DEFAULT_SERIALIZATION_FMT inherited

Default format used when serializing objects.

YAML_ENCODING inherited

Encoding used for YAML files.

capacity_scale inherited

The relative computational capacity of the most powerful CPU at its highest available frequency. Utilisation is in the interval [0, capacity_scale].

cpu_nodes inherited

List of leaf (CPU) EnergyModelNode.

cpus inherited

List of logical CPU numbers in the system.

Properties

biggest_cpus inherited

The CPUs with the highest compute capacity at their highest frequency.

cpu_groups inherited

List of lists of CPUs who share the same active state values.

is_heterogeneous inherited

True iff CPUs do not all have the same efficiency and OPP range.

littlest_cpus inherited

The CPUs with the lowest compute capacity at their highest frequency.

logger inherited

Convenience short-hand for self.get_logger().

node_groups inherited

List of lists of CPUs nodes who share the same active state values.

Methods

from_target()

Create an EnergyModel by reading a target filesystem.

probe_target()

Check if an EnergyModel can be loaded from the target.

__copy__() inherited

Regular shallow copy operation, without dropping any attributes.

__getstate__() inherited

Filter the instance’s attributes upon serialization.

__setstate__() inherited

estimate_from_cpu_util() inherited

Estimate the energy usage of the system under a utilization distribution.

estimate_from_trace() inherited

Estimate the energy consumption of the system by looking at a trace.

from_path() inherited

Deserialize an object from a file.

get_cpu_capacity() inherited

Convenience method to get the capacity of a CPU at a given frequency.

get_logger() inherited

Provides a logging.Logger named after cls.

get_optimal_placements() inherited

Find the optimal distribution of work for a set of tasks.

guess_freqs() inherited

Work out CPU frequencies required to execute a workload.

guess_idle_states() inherited

Pessimistically guess the idle states that each CPU may enter.

log_locals() inherited

Debugging aid: log the local variables of the calling function.

to_path() inherited

Serialize the object to a file.

to_yaml() inherited

Return a YAML string with the serialized object.

Attributes#

LegacyEnergyModel.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#

Inherited attribute, see lisa.utils.Serializable.ATTRIBUTES_SERIALIZATION

Attributes to be treated specially during serialization.

LegacyEnergyModel.DEFAULT_SERIALIZATION_FMT = 'yaml'#

Inherited attribute, see lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMT

Default format used when serializing objects.

LegacyEnergyModel.YAML_ENCODING = 'utf-8'#

Inherited attribute, see lisa.utils.Serializable.YAML_ENCODING

Encoding used for YAML files.

LegacyEnergyModel.capacity_scale#

Inherited attribute, see lisa.energy_model.EnergyModel.capacity_scale

The relative computational capacity of the most powerful CPU at its highest available frequency. Utilisation is in the interval [0, capacity_scale].

LegacyEnergyModel.cpu_nodes#

Inherited attribute, see lisa.energy_model.EnergyModel.cpu_nodes

List of leaf (CPU) EnergyModelNode.

LegacyEnergyModel.cpus#

Inherited attribute, see lisa.energy_model.EnergyModel.cpus

List of logical CPU numbers in the system.

Properties#

property LegacyEnergyModel.biggest_cpus#

Inherited property, see lisa.energy_model.EnergyModel.biggest_cpus

The CPUs with the highest compute capacity at their highest frequency.

property LegacyEnergyModel.cpu_groups#

Inherited property, see lisa.energy_model.EnergyModel.cpu_groups

List of lists of CPUs who share the same active state values.

property LegacyEnergyModel.is_heterogeneous#

Inherited property, see lisa.energy_model.EnergyModel.is_heterogeneous

True iff CPUs do not all have the same efficiency and OPP range.

property LegacyEnergyModel.littlest_cpus#

Inherited property, see lisa.energy_model.EnergyModel.littlest_cpus

The CPUs with the lowest compute capacity at their highest frequency.

property LegacyEnergyModel.logger#

Inherited property, see lisa.utils.Loggable.logger

Convenience short-hand for self.get_logger().

property LegacyEnergyModel.node_groups#

Inherited property, see lisa.energy_model.EnergyModel.node_groups

List of lists of CPUs nodes who share the same active state values.

Methods#

classmethod LegacyEnergyModel.from_target(target, filename='/proc/sys/kernel/sched_domain/cpu{}/domain{}/group{}/energy/{}')[source]#

Create an EnergyModel by reading a target filesystem

This uses the sysctl added by EAS patches to exposes the cap_states and idle_states fields for each sched_group. This feature depends on CONFIG_SCHED_DEBUG, and is not upstream in mainline Linux.

The kernel doesn’t have an power domain data, so this method assumes that all CPUs are totally independent wrt. idle states - the EnergyModel constructed won’t be aware of the topological dependencies for entering “cluster” idle states.

Assumes the energy model has two-levels (plus the root) - a level for CPUs and a level for ‘clusters’.

Parameters:

target – Devlib target object to read filesystem from. Must have cpufreq and cpuidle modules enabled.

Returns:

Constructed EnergyModel object based on the parameters reported by the target.

static LegacyEnergyModel.probe_target(target)[source]#

Check if an EnergyModel can be loaded from the target.

Parameters:

target (devlib.target.Target) – Target to look at.

LegacyEnergyModel.__copy__()#

Inherited method, see lisa.utils.Serializable.__copy__()

Regular shallow copy operation, without dropping any attributes.

LegacyEnergyModel.__getstate__()#

Inherited method, see lisa.utils.Serializable.__getstate__()

Filter the instance’s attributes upon serialization.

LegacyEnergyModel.__setstate__(dct)#

Inherited method, see lisa.utils.Serializable.__setstate__()

LegacyEnergyModel.estimate_from_cpu_util(cpu_utils, freqs=None, idle_states=None)#

Inherited method, see lisa.energy_model.EnergyModel.estimate_from_cpu_util()

Estimate the energy usage of the system under a utilization distribution.

LegacyEnergyModel.estimate_from_trace(trace)#

Inherited method, see lisa.energy_model.EnergyModel.estimate_from_trace()

Estimate the energy consumption of the system by looking at a trace.

classmethod LegacyEnergyModel.from_path(filepath, fmt=None)#

Inherited method, see lisa.utils.Serializable.from_path()

Deserialize an object from a file.

LegacyEnergyModel.get_cpu_capacity(cpu, freq=None)#

Inherited method, see lisa.energy_model.EnergyModel.get_cpu_capacity()

Convenience method to get the capacity of a CPU at a given frequency.

classmethod LegacyEnergyModel.get_logger(suffix=None)#

Inherited method, see lisa.utils.Loggable.get_logger()

Provides a logging.Logger named after cls.

LegacyEnergyModel.get_optimal_placements(capacities, capacity_margin_pct=0)#

Inherited method, see lisa.energy_model.EnergyModel.get_optimal_placements()

Find the optimal distribution of work for a set of tasks.

LegacyEnergyModel.guess_freqs(cpu_utils, capacity_margin_pct=0)#

Inherited method, see lisa.energy_model.EnergyModel.guess_freqs()

Work out CPU frequencies required to execute a workload.

LegacyEnergyModel.guess_idle_states(cpus_active)#

Inherited method, see lisa.energy_model.EnergyModel.guess_idle_states()

Pessimistically guess the idle states that each CPU may enter.

classmethod LegacyEnergyModel.log_locals(var_names=None, level='debug')#

Inherited method, see lisa.utils.Loggable.log_locals()

Debugging aid: log the local variables of the calling function.

LegacyEnergyModel.to_path(filepath, fmt=None)#

Inherited method, see lisa.utils.Serializable.to_path()

Serialize the object to a file.

LegacyEnergyModel.to_yaml()#

Inherited method, see lisa.utils.Serializable.to_yaml()

Return a YAML string with the serialized object.