lisa.energy_meter.EnergyMeter#
- class lisa.energy_meter.EnergyMeter(target, res_dir=None)[source]#
Bases:
Loggable
,Configurable
Abstract Base Class of energy meters.
Attributes
CONF_CLASS
inheritedConfiguration class associated with the current class.
INIT_KWARGS_KEY_MAP
inheritedDictionary of
__init__
parameter names to configuration key path.Properties
Methods
Build an instance of
EnergyMeter
from a configuration object.Get total energy consumption since last
reset()
.Reset the energy meter.
Get a sample from the energy meter.
check_init_param()
inheritedTake the same parameters as
__init__
, and check their types according to what is specified in the configuration class.conf_to_init_kwargs()
inheritedTurn a configuration object into a dictionary suitable for passing to
__init__
as**kwargs
.get_logger()
inheritedProvides a
logging.Logger
named aftercls
.log_locals()
inheritedDebugging aid: log the local variables of the calling function.
Attributes#
- EnergyMeter.CONF_CLASS = None#
Inherited attribute, see
lisa.conf.Configurable.CONF_CLASS
Configuration class associated with the current class.
- EnergyMeter.INIT_KWARGS_KEY_MAP = {}#
Inherited attribute, see
lisa.conf.Configurable.INIT_KWARGS_KEY_MAP
Dictionary of
__init__
parameter names to configuration key path.
Properties#
- property EnergyMeter.logger#
Inherited property, see
lisa.utils.Loggable.logger
Convenience short-hand for
self.get_logger()
.
Methods#
- classmethod EnergyMeter.from_conf(target, conf, res_dir=None)[source]#
Build an instance of
EnergyMeter
from a configuration object.- Parameters:
target (lisa.target.Target) – Target to use
conf – Configuration object to use
res_dir (str or None) – Result directory to use
- classmethod EnergyMeter.check_init_param(**kwargs)#
Inherited method, see
lisa.conf.Configurable.check_init_param()
Take the same parameters as
__init__
, and check their types according to what is specified in the configuration class.
- classmethod EnergyMeter.conf_to_init_kwargs(conf)#
Inherited method, see
lisa.conf.Configurable.conf_to_init_kwargs()
Turn a configuration object into a dictionary suitable for passing to
__init__
as**kwargs
.
- classmethod EnergyMeter.get_logger(suffix=None)#
Inherited method, see
lisa.utils.Loggable.get_logger()
Provides a
logging.Logger
named aftercls
.
- classmethod EnergyMeter.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.