geopm 3.2.1.dev535+ga96c120fc
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
geopm::CpuinfoIOGroup Class Reference

IOGroup that provides constants for CPU frequency limits as signals for PlatformIO. More...

#include <CpuinfoIOGroup.hpp>

Inheritance diagram for geopm::CpuinfoIOGroup:
Collaboration diagram for geopm::CpuinfoIOGroup:

Public Member Functions

 CpuinfoIOGroup ()
 CpuinfoIOGroup (const std::string &cpu_freq_min_path, const std::string &cpu_freq_max_path, double cpu_freq_sticker)
virtual ~CpuinfoIOGroup ()=default
std::set< std::string > signal_names (void) const override
std::set< std::string > control_names (void) const override
bool is_valid_signal (const std::string &signal_name) const override
bool is_valid_control (const std::string &control_name) const override
int signal_domain_type (const std::string &signal_name) const override
int control_domain_type (const std::string &control_name) const override
int push_signal (const std::string &signal_name, int domain_type, int domain_idx) override
int push_control (const std::string &control_name, int domain_type, int domain_idx) override
 Should not be called; this IOGroup does not provide any controls.
void read_batch (void) override
 Does nothing; this IOGroup's signals are constant.
void write_batch (void) override
 Does nothing; this IOGroup does not provide any controls.
double sample (int batch_idx) override
void adjust (int batch_idx, double setting) override
 Should not be called; this IOGroup does not provide any controls.
double read_signal (const std::string &signal_name, int domain_type, int domain_idx) override
void write_control (const std::string &control_name, int domain_type, int domain_idx, double setting) override
 Should not be called; this IOGroup does not provide any controls.
void save_control (void) override
 Does nothing; this IOGroup does not provide any controls.
void restore_control (void) override
 Does nothing; this IOGroup does not provide any controls.
std::function< double(const std::vector< double > &)> agg_function (const std::string &signal_name) const override
 For all valid signals in this IOGroup, the aggregation function is expect_same().
std::function< std::string(double)> format_function (const std::string &signal_name) const override
std::string signal_description (const std::string &signal_name) const override
std::string control_description (const std::string &control_name) const override
 Does nothing; this IOGroup does not provide any controls.
int signal_behavior (const std::string &signal_name) const override
void save_control (const std::string &save_path) override
 Does nothing; this IOGroup does not provide any controls.
void restore_control (const std::string &save_path) override
 Does nothing; this IOGroup does not provide any controls.
std::string name (void) const override
Public Member Functions inherited from geopm::IOGroup
 IOGroup ()=default
virtual ~IOGroup ()=default

Static Public Member Functions

static std::string plugin_name (void)
static std::unique_ptr< IOGroup > make_plugin (void)
Static Public Member Functions inherited from geopm::IOGroup
static std::vector< std::string > iogroup_names (void)
static std::unique_ptr< IOGroup > make_unique (const std::string &iogroup_name)
static m_units_e string_to_units (const std::string &str)
 Convert a string to the corresponding m_units_e value.
static std::string units_to_string (int)
 Convert the m_units_e value to the corresponding string.
static m_signal_behavior_e string_to_behavior (const std::string &str)
 Convert a string to the corresponding m_signal_behavior_e value.

Additional Inherited Members

Public Types inherited from geopm::IOGroup
enum  m_units_e {
  M_UNITS_NONE , M_UNITS_SECONDS , M_UNITS_HERTZ , M_UNITS_WATTS ,
  M_UNITS_JOULES , M_UNITS_CELSIUS , M_UNITS_AMPERES , M_UNITS_VOLTS ,
  M_NUM_UNITS
}
enum  m_signal_behavior_e {
  M_SIGNAL_BEHAVIOR_CONSTANT , M_SIGNAL_BEHAVIOR_MONOTONE , M_SIGNAL_BEHAVIOR_VARIABLE , M_SIGNAL_BEHAVIOR_LABEL ,
  M_NUM_SIGNAL_BEHAVIOR
}
 Description of the runtime behavior of a signal. More...
Static Public Attributes inherited from geopm::IOGroup
static const std::string M_PLUGIN_PREFIX = "libgeopmiogroup_"

Detailed Description

IOGroup that provides constants for CPU frequency limits as signals for PlatformIO.

Constructor & Destructor Documentation

◆ CpuinfoIOGroup() [1/2]

geopm::CpuinfoIOGroup::CpuinfoIOGroup ( )

◆ CpuinfoIOGroup() [2/2]

geopm::CpuinfoIOGroup::CpuinfoIOGroup ( const std::string & cpu_freq_min_path,
const std::string & cpu_freq_max_path,
double cpu_freq_sticker )

◆ ~CpuinfoIOGroup()

virtual geopm::CpuinfoIOGroup::~CpuinfoIOGroup ( )
virtualdefault

Member Function Documentation

◆ adjust()

void geopm::CpuinfoIOGroup::adjust ( int batch_idx,
double setting )
overridevirtual

Should not be called; this IOGroup does not provide any controls.

Exceptions
geopm::Exceptionthere are no controls supported by the CpuinfoIOGroup

Implements geopm::IOGroup.

◆ agg_function()

std::function< double(const std::vector< double > &)> geopm::CpuinfoIOGroup::agg_function ( const std::string & signal_name) const
overridevirtual

For all valid signals in this IOGroup, the aggregation function is expect_same().

If any frequency range constants are compared between nodes, they should be the same or the runtime may behave unpredictably.

Returns
a function that should be used when aggregating the given signal.
See also
geopm::Agg

Implements geopm::IOGroup.

◆ control_description()

std::string geopm::CpuinfoIOGroup::control_description ( const std::string & control_name) const
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Returns
empty string

Implements geopm::IOGroup.

◆ control_domain_type()

int geopm::CpuinfoIOGroup::control_domain_type ( const std::string & control_name) const
overridevirtual
Returns
GEOPM_DOMAIN_INVALID; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ control_names()

std::set< std::string > geopm::CpuinfoIOGroup::control_names ( void ) const
overridevirtual
Returns
empty set; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ format_function()

std::function< std::string(double)> geopm::CpuinfoIOGroup::format_function ( const std::string & signal_name) const
overridevirtual
Returns
a function that should be used when formatting the given signal.
See also
geopm::Agg

Reimplemented from geopm::IOGroup.

◆ is_valid_control()

bool geopm::CpuinfoIOGroup::is_valid_control ( const std::string & control_name) const
overridevirtual
Returns
false; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ is_valid_signal()

bool geopm::CpuinfoIOGroup::is_valid_signal ( const std::string & signal_name) const
overridevirtual
Returns
whether the given signal_name is supported by the CpuinfoIOGroup for the current platform.

Implements geopm::IOGroup.

◆ make_plugin()

std::unique_ptr< IOGroup > geopm::CpuinfoIOGroup::make_plugin ( void )
static
Returns
a pointer to a new CpuinfoIOGroup object
See also
geopm::PluginFactory

◆ name()

std::string geopm::CpuinfoIOGroup::name ( void ) const
overridevirtual
Returns
the name of the IOGroup

Implements geopm::IOGroup.

◆ plugin_name()

std::string geopm::CpuinfoIOGroup::plugin_name ( void )
static
Returns
the name of the plugin to use when this plugin is registered with the IOGroup factory
See also
geopm::PluginFactory

◆ push_control()

int geopm::CpuinfoIOGroup::push_control ( const std::string & control_name,
int domain_type,
int domain_idx )
overridevirtual

Should not be called; this IOGroup does not provide any controls.

Exceptions
geopm::Exceptionthere are no controls supported by the CpuinfoIOGroup

Implements geopm::IOGroup.

◆ push_signal()

int geopm::CpuinfoIOGroup::push_signal ( const std::string & signal_name,
int domain_type,
int domain_idx )
overridevirtual
Parameters
signal_nameAdds the signal specified to the list of signals to be read during read_batch()
domain_typeThis must be == GEOPM_DOMAIN_BOARD
domain_idxis ignored
Exceptions
geopm::Exceptionif signal_name is not valid if domain_type is not GEOPM_DOMAIN_BOARD

Implements geopm::IOGroup.

◆ read_batch()

void geopm::CpuinfoIOGroup::read_batch ( void )
overridevirtual

Does nothing; this IOGroup's signals are constant.

Implements geopm::IOGroup.

◆ read_signal()

double geopm::CpuinfoIOGroup::read_signal ( const std::string & signal_name,
int domain_type,
int domain_idx )
overridevirtual
Parameters
signal_nameSpecifies the name of the signal whose value you want to get.
domain_typeThis must be == GEOPM_DOMAIN_BOARD
domain_idxis ignored
Exceptions
geopm::Exceptionif signal_name is not valid if domain_type is not GEOPM_DOMAIN_BOARD
Returns
the stored value for the given signal_name.

Implements geopm::IOGroup.

◆ restore_control() [1/2]

void geopm::CpuinfoIOGroup::restore_control ( const std::string & save_path)
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Parameters
save_paththis argument is ignored

Implements geopm::IOGroup.

◆ restore_control() [2/2]

void geopm::CpuinfoIOGroup::restore_control ( void )
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ sample()

double geopm::CpuinfoIOGroup::sample ( int batch_idx)
overridevirtual
Parameters
batch_idxSpecifies a signal_idx returned from push_signal()
Returns
the value of the signal specified by a signal_idx returned from push_signal().

The value will have been updated by the most recent call to read_batch().

Implements geopm::IOGroup.

◆ save_control() [1/2]

void geopm::CpuinfoIOGroup::save_control ( const std::string & save_path)
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Parameters
save_paththis argument is ignored

Implements geopm::IOGroup.

◆ save_control() [2/2]

void geopm::CpuinfoIOGroup::save_control ( void )
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ signal_behavior()

int geopm::CpuinfoIOGroup::signal_behavior ( const std::string & signal_name) const
overridevirtual
Returns
one of the IOGroup::signal_behavior_e values which describes about how a signal will change as a function of time.

This can be used when generating reports to decide how to summarize a signal's value for the entire application run.

Implements geopm::IOGroup.

◆ signal_description()

std::string geopm::CpuinfoIOGroup::signal_description ( const std::string & signal_name) const
overridevirtual
Returns
a string description for signal_name, if defined.

Implements geopm::IOGroup.

◆ signal_domain_type()

int geopm::CpuinfoIOGroup::signal_domain_type ( const std::string & signal_name) const
overridevirtual
Returns
GEOPM_DOMAIN_BOARD; If the signal_name is valid for this IOGroup,

All constants provided by the CpuinfoIOGroup are assumed to be the same for the whole board.

Implements geopm::IOGroup.

◆ signal_names()

std::set< std::string > geopm::CpuinfoIOGroup::signal_names ( void ) const
overridevirtual
Returns
the list of signal names provided by this IOGroup.

Implements geopm::IOGroup.

◆ write_batch()

void geopm::CpuinfoIOGroup::write_batch ( void )
overridevirtual

Does nothing; this IOGroup does not provide any controls.

Implements geopm::IOGroup.

◆ write_control()

void geopm::CpuinfoIOGroup::write_control ( const std::string & control_name,
int domain_type,
int domain_idx,
double setting )
overridevirtual

Should not be called; this IOGroup does not provide any controls.

Exceptions
geopm::Exceptionthere are no controls supported by the CpuinfoIOGroup

Implements geopm::IOGroup.


The documentation for this class was generated from the following files: