geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
geopm::IOGroup Class Referenceabstract

#include <IOGroup.hpp>

Inheritance diagram for geopm::IOGroup:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 IOGroup ()=default
 
virtual ~IOGroup ()=default
 
virtual std::set< std::string > signal_names (void) const =0
 Returns the names of all signals provided by the IOGroup. More...
 
virtual std::set< std::string > control_names (void) const =0
 Returns the names of all controls provided by the IOGroup. More...
 
virtual bool is_valid_signal (const std::string &signal_name) const =0
 Test if signal_name refers to a signal supported by the group. More...
 
virtual bool is_valid_control (const std::string &control_name) const =0
 Test if control_name refers to a control supported by the group. More...
 
virtual int signal_domain_type (const std::string &signal_name) const =0
 Query the domain for a named signal. More...
 
virtual int control_domain_type (const std::string &control_name) const =0
 Query the domain for a named control. More...
 
virtual int push_signal (const std::string &signal_name, int domain_type, int domain_idx)=0
 Add a signal to the list of signals that is read by read_batch() and sampled by sample(). More...
 
virtual int push_control (const std::string &control_name, int domain_type, int domain_idx)=0
 Add a control to the list of controls that is written by write_batch() and configured with adjust(). More...
 
virtual void read_batch (void)=0
 Read all pushed signals from the platform so that the next call to sample() will reflect the updated data. More...
 
virtual void write_batch (void)=0
 Write all of the pushed controls so that values previously given to adjust() are written to the platform. More...
 
virtual double sample (int sample_idx)=0
 Retrieve signal value from data read by last call to read_batch() for a particular signal previously pushed with push_signal(). More...
 
virtual void adjust (int control_idx, double setting)=0
 Adjust a setting for a particular control that was previously pushed with push_control(). This adjustment will be written to the platform on the next call to write_batch(). More...
 
virtual double read_signal (const std::string &signal_name, int domain_type, int domain_idx)=0
 Read from platform and interpret into SI units a signal given its name and domain. Does not modify the values stored by calling read_batch(). More...
 
virtual void write_control (const std::string &control_name, int domain_type, int domain_idx, double setting)=0
 Interpret the setting and write setting to the platform. Does not modify the values stored by calling adjust(). More...
 
virtual void save_control (void)=0
 Save the state of all controls so that any subsequent changes made through the IOGroup can be undone with a call to the restore() method. More...
 
virtual void restore_control (void)=0
 Restore all controls to values recorded in previous call to the save() method. More...
 
virtual std::function< double(const std::vector< double > &)> agg_function (const std::string &signal_name) const =0
 Return a function that should be used when aggregating the given signal. More...
 
virtual std::function< std::string(double)> format_function (const std::string &signal_name) const
 Returns a function that can be used to convert a signal of the given name into a printable string. May be one of the IOGroup::format_*() static methods, or another function. More...
 
virtual std::string signal_description (const std::string &signal_name) const =0
 Returns a description of the signal. This string can be used by tools to generate help text for users of the IOGroup. More...
 
virtual std::string control_description (const std::string &control_name) const =0
 Returns a description of the control. This string can be used by tools to generate help text for users of the IOGroup. More...
 
virtual int signal_behavior (const std::string &signal_name) const =0
 Returns a hint about how a signal will change as a function of time. More...
 
virtual void save_control (const std::string &save_path)=0
 
virtual void restore_control (const std::string &save_path)=0
 
virtual std::string name (void) const =0
 Get the IOGroup name. More...
 

Static Public Member Functions

static std::vector< std::string > iogroup_names (void)
 
static std::unique_ptr< IOGroupmake_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. More...
 
static std::string units_to_string (int)
 Convert the m_units_e value to the corresponding string. More...
 
static m_signal_behavior_e string_to_behavior (const std::string &str)
 Convert a string to the corresponding m_signal_behavior_e value. More...
 

Static Public Attributes

static const std::string M_PLUGIN_PREFIX = "libgeopmiogroup_"
 

Member Enumeration Documentation

◆ m_signal_behavior_e

Description of the runtime behavior of a signal.

Enumerator
M_SIGNAL_BEHAVIOR_CONSTANT 

signals that have a constant value

M_SIGNAL_BEHAVIOR_MONOTONE 

signals that increase monotonically

M_SIGNAL_BEHAVIOR_VARIABLE 

signals that vary up and down over time

M_SIGNAL_BEHAVIOR_LABEL 

signals that should not be summarized over time

M_NUM_SIGNAL_BEHAVIOR 

◆ m_units_e

Enumerator
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 

Constructor & Destructor Documentation

◆ IOGroup()

geopm::IOGroup::IOGroup ( )
default

◆ ~IOGroup()

virtual geopm::IOGroup::~IOGroup ( )
virtualdefault

Member Function Documentation

◆ adjust()

virtual void geopm::IOGroup::adjust ( int  control_idx,
double  setting 
)
pure virtual

Adjust a setting for a particular control that was previously pushed with push_control(). This adjustment will be written to the platform on the next call to write_batch().

Parameters
[in]control_idxThe index returned by previous call to push_control().
[in]settingValue of the control in SI units.

Implemented in geopm::ServiceIOGroup, geopm::MSRIOGroup, geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::NVMLIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ agg_function()

virtual std::function<double(const std::vector<double> &)> geopm::IOGroup::agg_function ( const std::string &  signal_name) const
pure virtual

Return a function that should be used when aggregating the given signal.

Parameters
[in]signal_nameName of the signal.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ control_description()

virtual std::string geopm::IOGroup::control_description ( const std::string &  control_name) const
pure virtual

Returns a description of the control. This string can be used by tools to generate help text for users of the IOGroup.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ control_domain_type()

virtual int geopm::IOGroup::control_domain_type ( const std::string &  control_name) const
pure virtual

Query the domain for a named control.

Parameters
[in]control_nameName of the control to query.
Returns
One of the PlatformTopo::m_domain_e enum values.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ control_names()

virtual std::set<std::string> geopm::IOGroup::control_names ( void  ) const
pure virtual

◆ format_function()

std::function< std::string(double)> geopm::IOGroup::format_function ( const std::string &  signal_name) const
virtual

Returns a function that can be used to convert a signal of the given name into a printable string. May be one of the IOGroup::format_*() static methods, or another function.

Reimplemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ iogroup_names()

std::vector< std::string > geopm::IOGroup::iogroup_names ( void  )
static

◆ is_valid_control()

virtual bool geopm::IOGroup::is_valid_control ( const std::string &  control_name) const
pure virtual

Test if control_name refers to a control supported by the group.

Parameters
[in]control_nameName of control to test.
Returns
True if control is supported, false otherwise.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ is_valid_signal()

virtual bool geopm::IOGroup::is_valid_signal ( const std::string &  signal_name) const
pure virtual

Test if signal_name refers to a signal supported by the group.

Parameters
[in]signal_nameName of signal to test.
Returns
True if signal is supported, false otherwise.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ make_unique()

std::unique_ptr< IOGroup > geopm::IOGroup::make_unique ( const std::string &  iogroup_name)
static

◆ name()

virtual std::string geopm::IOGroup::name ( void  ) const
pure virtual

Get the IOGroup name.

By convention this name is given in all capital letters. This string provides a namespace for the IOGroup since all IOGroups loaded by PlatformIO must have distinct names. This unique namespace may be used in any context to distinguish IOGroups.

One important use case is that the IOGroup name prefixes all low level signal and control names in conjunction with "::". This name prefix may be used to distinguish between the high level signals and controls (i.e. aliases like CPU_FREQUENCY_MAX_CONTROL) that do not contain the IOGroup prefix, and the low level signals and controls that do (e.g. "MSR::PERF_CTL:FREQ").

Returns
The name of the IOGroup in all caps.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ push_control()

virtual int geopm::IOGroup::push_control ( const std::string &  control_name,
int  domain_type,
int  domain_idx 
)
pure virtual

Add a control to the list of controls that is written by write_batch() and configured with adjust().

Parameters
[in]control_nameName of the control requested.
[in]domain_typeOne of the values from the PlatformTopo::m_domain_e enum described in PlatformTopo.hpp.
[in]domain_idxThe index of the domain within the set of domains of the same type on the platform.
Returns
Index of control when adjust() method is called.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ push_signal()

virtual int geopm::IOGroup::push_signal ( const std::string &  signal_name,
int  domain_type,
int  domain_idx 
)
pure virtual

Add a signal to the list of signals that is read by read_batch() and sampled by sample().

Parameters
[in]signal_nameName of the signal requested.
[in]domain_typeOne of the values from the PlatformTopo::m_domain_e enum described in PlatformTopo.hpp.
[in]domain_idxThe index of the domain within the set of domains of the same type on the platform.
Returns
Index of signal when sample() method is called.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ read_batch()

virtual void geopm::IOGroup::read_batch ( void  )
pure virtual

◆ read_signal()

virtual double geopm::IOGroup::read_signal ( const std::string &  signal_name,
int  domain_type,
int  domain_idx 
)
pure virtual

Read from platform and interpret into SI units a signal given its name and domain. Does not modify the values stored by calling read_batch().

Parameters
[in]signal_nameName of the signal requested.
[in]domain_typeOne of the values from the PlatformTopo::m_domain_e enum described in PlatformTopo.hpp.
[in]domain_idxThe index of the domain within the set of domains of the same type on the platform.
Returns
The value in SI units of the signal.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ restore_control() [1/2]

virtual void geopm::IOGroup::restore_control ( const std::string &  save_path)
pure virtual

◆ restore_control() [2/2]

virtual void geopm::IOGroup::restore_control ( void  )
pure virtual

◆ sample()

virtual double geopm::IOGroup::sample ( int  sample_idx)
pure virtual

Retrieve signal value from data read by last call to read_batch() for a particular signal previously pushed with push_signal().

Parameters
[in]sample_idxThe index returned by previous call to push_signal().
Returns
Value of signal in SI units.

Implemented in geopm::ServiceIOGroup, geopm::MSRIOGroup, geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::NVMLIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ save_control() [1/2]

virtual void geopm::IOGroup::save_control ( const std::string &  save_path)
pure virtual

◆ save_control() [2/2]

virtual void geopm::IOGroup::save_control ( void  )
pure virtual

Save the state of all controls so that any subsequent changes made through the IOGroup can be undone with a call to the restore() method.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ signal_behavior()

virtual int geopm::IOGroup::signal_behavior ( const std::string &  signal_name) const
pure virtual

Returns a hint 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.

Parameters
[in]signal_nameName of the signal.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ signal_description()

virtual std::string geopm::IOGroup::signal_description ( const std::string &  signal_name) const
pure virtual

Returns a description of the signal. This string can be used by tools to generate help text for users of the IOGroup.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ signal_domain_type()

virtual int geopm::IOGroup::signal_domain_type ( const std::string &  signal_name) const
pure virtual

Query the domain for a named signal.

Parameters
[in]signal_nameName of the signal to query.
Returns
One of the PlatformTopo::m_domain_e enum values.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

◆ signal_names()

virtual std::set<std::string> geopm::IOGroup::signal_names ( void  ) const
pure virtual

◆ string_to_behavior()

IOGroup::m_signal_behavior_e geopm::IOGroup::string_to_behavior ( const std::string &  str)
static

Convert a string to the corresponding m_signal_behavior_e value.

◆ string_to_units()

IOGroup::m_units_e geopm::IOGroup::string_to_units ( const std::string &  str)
static

Convert a string to the corresponding m_units_e value.

◆ units_to_string()

std::string geopm::IOGroup::units_to_string ( int  uni)
static

Convert the m_units_e value to the corresponding string.

◆ write_batch()

virtual void geopm::IOGroup::write_batch ( void  )
pure virtual

◆ write_control()

virtual void geopm::IOGroup::write_control ( const std::string &  control_name,
int  domain_type,
int  domain_idx,
double  setting 
)
pure virtual

Interpret the setting and write setting to the platform. Does not modify the values stored by calling adjust().

Parameters
[in]control_nameName of the control requested.
[in]domain_typeOne of the values from the PlatformTopo::m_domain_e enum described in PlatformTopo.hpp.
[in]domain_idxThe index of the domain within the set of domains of the same type on the platform.
[in]settingValue in SI units of the setting for the control.

Implemented in geopm::TimeIOGroup, geopm::SysfsIOGroup, geopm::SSTIOGroup, geopm::ServiceIOGroup, geopm::NVMLIOGroup, geopm::MSRIOGroup, geopm::LevelZeroIOGroup, geopm::DCGMIOGroup, geopm::CpuinfoIOGroup, geopm::ConstConfigIOGroup, and geopm::CNLIOGroup.

Member Data Documentation

◆ M_PLUGIN_PREFIX

const std::string geopm::IOGroup::M_PLUGIN_PREFIX = "libgeopmiogroup_"
static

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