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 inherited

Configuration class associated with the current class.

INIT_KWARGS_KEY_MAP inherited

Dictionary of __init__ parameter names to configuration key path.

Properties

name

logger inherited

Convenience short-hand for self.get_logger().

Methods

from_conf()

Build an instance of EnergyMeter from a configuration object.

report()

Get total energy consumption since last reset().

reset()

Reset the energy meter.

sample()

Get a sample from the energy meter.

check_init_param() inherited

Take the same parameters as __init__, and check their types according to what is specified in the configuration class.

conf_to_init_kwargs() inherited

Turn a configuration object into a dictionary suitable for passing to __init__ as **kwargs.

get_logger() inherited

Provides a logging.Logger named after cls.

log_locals() inherited

Debugging 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#

abstract property EnergyMeter.name[source]#
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

abstract EnergyMeter.report()[source]#

Get total energy consumption since last reset()

abstract EnergyMeter.reset()[source]#

Reset the energy meter

abstract EnergyMeter.sample()[source]#

Get a sample from the energy meter

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 after cls.

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.