lisa.energy_model.LinuxEnergyModel#
- class lisa.energy_model.LinuxEnergyModel(root_node, root_power_domain, freq_domains)[source]#
Bases:
EnergyModel
Mainline Linux kernel energy model, available since linux 5.0 .
The energy model information is stored in debugfs.
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
inheritedAttributes to be treated specially during serialization.
DEFAULT_SERIALIZATION_FMT
inheritedDefault format used when serializing objects.
YAML_ENCODING
inheritedEncoding used for YAML files.
capacity_scale
inheritedThe relative computational capacity of the most powerful CPU at its highest available frequency. Utilisation is in the interval
[0, capacity_scale]
.cpu_nodes
inheritedList of leaf (CPU)
EnergyModelNode
.cpus
inheritedList of logical CPU numbers in the system.
Properties
biggest_cpus
inheritedThe CPUs with the highest compute capacity at their highest frequency.
cpu_groups
inheritedList of lists of CPUs who share the same active state values.
is_heterogeneous
inheritedTrue iff CPUs do not all have the same efficiency and OPP range.
littlest_cpus
inheritedThe CPUs with the lowest compute capacity at their highest frequency.
logger
inheritedConvenience short-hand for
self.get_logger()
.node_groups
inheritedList of lists of CPUs nodes who share the same active state values.
Methods
Create an
EnergyModel
by reading a target filesystem on a device with the new Simplified Energy Model present in debugfs.Check if an
EnergyModel
can be loaded from the target.__copy__()
inheritedRegular shallow copy operation, without dropping any attributes.
__getstate__()
inheritedFilter the instance’s attributes upon serialization.
__setstate__()
inheritedestimate_from_cpu_util()
inheritedEstimate the energy usage of the system under a utilization distribution.
estimate_from_trace()
inheritedEstimate the energy consumption of the system by looking at a trace.
from_path()
inheritedDeserialize an object from a file.
get_cpu_capacity()
inheritedConvenience method to get the capacity of a CPU at a given frequency.
get_logger()
inheritedProvides a
logging.Logger
named aftercls
.get_optimal_placements()
inheritedFind the optimal distribution of work for a set of tasks.
guess_freqs()
inheritedWork out CPU frequencies required to execute a workload.
guess_idle_states()
inheritedPessimistically guess the idle states that each CPU may enter.
log_locals()
inheritedDebugging aid: log the local variables of the calling function.
to_path()
inheritedSerialize the object to a file.
to_yaml()
inheritedReturn a YAML string with the serialized object.
Attributes#
- LinuxEnergyModel.ATTRIBUTES_SERIALIZATION = {'allowed': [], 'ignored': [], 'placeholders': {}}#
Inherited attribute, see
lisa.utils.Serializable.ATTRIBUTES_SERIALIZATION
Attributes to be treated specially during serialization.
- LinuxEnergyModel.DEFAULT_SERIALIZATION_FMT = 'yaml'#
Inherited attribute, see
lisa.utils.Serializable.DEFAULT_SERIALIZATION_FMT
Default format used when serializing objects.
- LinuxEnergyModel.YAML_ENCODING = 'utf-8'#
Inherited attribute, see
lisa.utils.Serializable.YAML_ENCODING
Encoding used for YAML files.
- LinuxEnergyModel.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]
.
- LinuxEnergyModel.cpu_nodes#
Inherited attribute, see
lisa.energy_model.EnergyModel.cpu_nodes
List of leaf (CPU)
EnergyModelNode
.
- LinuxEnergyModel.cpus#
Inherited attribute, see
lisa.energy_model.EnergyModel.cpus
List of logical CPU numbers in the system.
Properties#
- property LinuxEnergyModel.biggest_cpus#
Inherited property, see
lisa.energy_model.EnergyModel.biggest_cpus
The CPUs with the highest compute capacity at their highest frequency.
- property LinuxEnergyModel.cpu_groups#
Inherited property, see
lisa.energy_model.EnergyModel.cpu_groups
List of lists of CPUs who share the same active state values.
- property LinuxEnergyModel.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 LinuxEnergyModel.littlest_cpus#
Inherited property, see
lisa.energy_model.EnergyModel.littlest_cpus
The CPUs with the lowest compute capacity at their highest frequency.
- property LinuxEnergyModel.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
- property LinuxEnergyModel.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 LinuxEnergyModel.from_target(target, directory='/sys/kernel/debug/energy_model')[source]#
Create an
EnergyModel
by reading a target filesystem on a device with the new Simplified Energy Model present in debugfs.- Parameters:
target (lisa.target.Target) – Target object to read filesystem from.
This uses the energy_model debugfs used usptream to expose the performance domains, their frequencies and power costs. This feature is upstream as of Linux 5.1. It is also available on Android 4.19 and later.
Wrt. idle states - the EnergyModel constructed won’t be aware of any power data or topological dependencies for entering “cluster” idle states since the simplified model has no such concept.
Note
Initialises only class:ActiveStates for CPUs and clears all other levels.
The recognized debugfs hierarchy pointed at by
directory
is:|-- cpu0 | |-- cpus | |-- ps:450000 | | |-- cost | | |-- frequency | | `-- power | |-- ps:575000 | | |-- cost | | |-- frequency | | `-- power | `-- ps:850000 | |-- cost | |-- frequency | `-- power `-- cpu1 |-- cpus |-- ps:1100000 | |-- cost | |-- frequency | `-- power |-- ps:450000 | |-- cost | |-- frequency | `-- power `-- ps:950000 |-- cost |-- frequency `-- power
- static LinuxEnergyModel.probe_target(target)[source]#
Check if an
EnergyModel
can be loaded from the target.- Parameters:
target (devlib.target.Target) – Target to look at.
- LinuxEnergyModel.__copy__()#
Inherited method, see
lisa.utils.Serializable.__copy__()
Regular shallow copy operation, without dropping any attributes.
- LinuxEnergyModel.__getstate__()#
Inherited method, see
lisa.utils.Serializable.__getstate__()
Filter the instance’s attributes upon serialization.
- LinuxEnergyModel.__setstate__(dct)#
Inherited method, see
lisa.utils.Serializable.__setstate__()
- LinuxEnergyModel.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.
- LinuxEnergyModel.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 LinuxEnergyModel.from_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.from_path()
Deserialize an object from a file.
- LinuxEnergyModel.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 LinuxEnergyModel.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- LinuxEnergyModel.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.
- LinuxEnergyModel.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.
- LinuxEnergyModel.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 LinuxEnergyModel.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.
- LinuxEnergyModel.to_path(filepath, fmt=None)#
Inherited method, see
lisa.utils.Serializable.to_path()
Serialize the object to a file.
- LinuxEnergyModel.to_yaml()#
Inherited method, see
lisa.utils.Serializable.to_yaml()
Return a YAML string with the serialized object.