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

Class which is a collection of all valid control and signal objects for a platform. More...

#include <PlatformIO.hpp>

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

Public Member Functions

 PlatformIO ()=default
 
virtual ~PlatformIO ()=default
 
virtual void register_iogroup (std::shared_ptr< IOGroup > iogroup)=0
 Registers an IOGroup with the PlatformIO so that its signals and controls are available through the PlatformIO interface. More...
 
virtual std::set< std::string > signal_names (void) const =0
 Returns the names of all available signals. This includes all signals and aliases provided by IOGroups as well as signals provided by PlatformIO itself. More...
 
virtual std::set< std::string > control_names (void) const =0
 Returns the names of all available controls. This includes all controls and aliases provided by IOGroups as well as controls provided by PlatformIO itself. 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
 Push a signal onto the end of the vector that can be sampled. More...
 
virtual int push_control (const std::string &control_name, int domain_type, int domain_idx)=0
 Push a control onto the end of the vector that can be adjusted. More...
 
virtual double sample (int signal_idx)=0
 Sample a single signal that has been pushed on to the signal stack. Must be called after a call to read_batch(void) method which updates the state of all signals. More...
 
virtual void adjust (int control_idx, double setting)=0
 Adjust a single control that has been pushed on to the control stack. This control will not take effect until the next call to write_batch(void). More...
 
virtual void read_batch (void)=0
 Read all pushed signals 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 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 PlatformIO can be undone with a call to the restore_control() method. More...
 
virtual void restore_control (void)=0
 Restore all controls to values recorded in previous call to the save_control() method. More...
 
virtual std::function< double(const std::vector< double > &)> agg_function (const std::string &signal_name) const =0
 Returns a function appropriate for aggregating multiple values of the given signal into a single value. More...
 
virtual std::function< std::string(double)> format_function (const std::string &signal_name) const =0
 Returns a function that can be used to convert a signal of the given name into a printable string. 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 PlatformIO. 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 PlatformIO. 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_dir)=0
 Save the state of all controls so that any subsequent changes made through PlatformIO can be undone with a call to the restore_control() method. Each IOGroup that supports controls will populate one file in the save directory that contains the saved state and name the file after the IOGroup name. More...
 
virtual void restore_control (const std::string &save_dir)=0
 Restore all controls to values recorded in previous call to the save_control(save_dir) method. The directory provided contains the result of the previous saved state. More...
 
virtual void start_batch_server (int client_pid, const std::vector< geopm_request_s > &signal_config, const std::vector< geopm_request_s > &control_config, int &server_pid, std::string &server_key)=0
 
virtual void stop_batch_server (int server_pid)=0
 

Static Public Member Functions

static bool is_valid_value (double value)
 

Detailed Description

Class which is a collection of all valid control and signal objects for a platform.

Constructor & Destructor Documentation

◆ PlatformIO()

geopm::PlatformIO::PlatformIO ( )
default

◆ ~PlatformIO()

virtual geopm::PlatformIO::~PlatformIO ( )
virtualdefault

Member Function Documentation

◆ adjust()

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

Adjust a single control that has been pushed on to the control stack. This control will not take effect until the next call to write_batch(void).

Parameters
[in]control_idxIndex of control to be adjusted returned by a previous call to the push_control() method.
[in]settingValue of control parameter in SI units.

Implemented in geopm::PlatformIOImp.

◆ agg_function()

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

Returns a function appropriate for aggregating multiple values of the given signal into a single value.

Parameters
[in]signal_nameName of the signal.
Returns
A function from vector<double> to double.

Implemented in geopm::PlatformIOImp.

◆ control_description()

virtual std::string geopm::PlatformIO::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 PlatformIO.

Implemented in geopm::PlatformIOImp.

◆ control_domain_type()

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

Query the domain for a named control.

Parameters
[in]control_nameThe name of the control.
Returns
One of the geopm_domain_e values signifying the granularity at which the control can be adjusted. Will return GEOPM_DOMAIN_INVALID if the signal name is not supported.

Implemented in geopm::PlatformIOImp.

◆ control_names()

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

Returns the names of all available controls. This includes all controls and aliases provided by IOGroups as well as controls provided by PlatformIO itself.

Implemented in geopm::PlatformIOImp.

◆ format_function()

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

Returns a function that can be used to convert a signal of the given name into a printable string.

Parameters
[in]signal_nameName of the signal.
Returns
A function from double to formatted std::string.

Implemented in geopm::PlatformIOImp.

◆ is_valid_value()

bool geopm::PlatformIO::is_valid_value ( double  value)
static
Parameters
[in]valueCheck if the given parameter is a valid value.
Returns
true if the value is valid, false if the value is invalid.

◆ push_control()

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

Push a control onto the end of the vector that can be adjusted.

Parameters
[in]control_nameName of the control requested.
[in]domain_typeOne of the values from the geopm_domain_e enum described in geopm_topo.h
[in]domain_idxThe index of the domain within the set of domains of the same type on the platform.
Returns
Index of the control if the requested control is valid, otherwise throws. Returned control index will be repeated for each unique tuple of the push_control input parameters.

Implemented in geopm::PlatformIOImp.

◆ push_signal()

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

Push a signal onto the end of the vector that can be sampled.

Parameters
[in]signal_nameName of the signal requested.
[in]domain_typeOne of the values from the geopm_domain_e enum described in geopm_topo.h
[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 or throws if the signal is not valid on the platform. Returned signal index will be repeated for each unique tuple of push_signal input parameters.

Implemented in geopm::PlatformIOImp.

◆ read_batch()

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

Read all pushed signals so that the next call to sample() will reflect the updated data.

Implemented in geopm::PlatformIOImp.

◆ read_signal()

virtual double geopm::PlatformIO::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 geopm_domain_e enum described in geopm_topo.h
[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::PlatformIOImp.

◆ register_iogroup()

virtual void geopm::PlatformIO::register_iogroup ( std::shared_ptr< IOGroup iogroup)
pure virtual

Registers an IOGroup with the PlatformIO so that its signals and controls are available through the PlatformIO interface.

This method provides the mechanism for extending the PlatformIO interface at runtime.

Parameters
[in]iogroupShared pointer to the IOGroup object.

Implemented in geopm::PlatformIOImp.

◆ restore_control() [1/2]

virtual void geopm::PlatformIO::restore_control ( const std::string &  save_dir)
pure virtual

Restore all controls to values recorded in previous call to the save_control(save_dir) method. The directory provided contains the result of the previous saved state.

Parameters
[in]save_dirDirectory populated with save files.

Implemented in geopm::PlatformIOImp.

◆ restore_control() [2/2]

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

Restore all controls to values recorded in previous call to the save_control() method.

Implemented in geopm::PlatformIOImp.

◆ sample()

virtual double geopm::PlatformIO::sample ( int  signal_idx)
pure virtual

Sample a single signal that has been pushed on to the signal stack. Must be called after a call to read_batch(void) method which updates the state of all signals.

Parameters
[in]signal_idxindex returned by a previous call to the push_signal() method.
Returns
Signal value measured from the platform in SI units.

Implemented in geopm::PlatformIOImp.

◆ save_control() [1/2]

virtual void geopm::PlatformIO::save_control ( const std::string &  save_dir)
pure virtual

Save the state of all controls so that any subsequent changes made through PlatformIO can be undone with a call to the restore_control() method. Each IOGroup that supports controls will populate one file in the save directory that contains the saved state and name the file after the IOGroup name.

Parameters
[in]save_dirDirectory to be populated with save files.

Implemented in geopm::PlatformIOImp.

◆ save_control() [2/2]

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

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

Implemented in geopm::PlatformIOImp.

◆ signal_behavior()

virtual int geopm::PlatformIO::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.
Returns
One of the IOGroup::m_signal_behavior_e enum values that identifies the signal behavior

Implemented in geopm::PlatformIOImp.

◆ signal_description()

virtual std::string geopm::PlatformIO::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 PlatformIO.

Implemented in geopm::PlatformIOImp.

◆ signal_domain_type()

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

Query the domain for a named signal.

Parameters
[in]signal_nameThe name of the signal.
Returns
One of the geopm_domain_e values signifying the granularity at which the signal is measured. Will return GEOPM_DOMAIN_INVALID if the signal name is not supported.

Implemented in geopm::PlatformIOImp.

◆ signal_names()

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

Returns the names of all available signals. This includes all signals and aliases provided by IOGroups as well as signals provided by PlatformIO itself.

Implemented in geopm::PlatformIOImp.

◆ start_batch_server()

virtual void geopm::PlatformIO::start_batch_server ( int  client_pid,
const std::vector< geopm_request_s > &  signal_config,
const std::vector< geopm_request_s > &  control_config,
int &  server_pid,
std::string &  server_key 
)
pure virtual

Implemented in geopm::PlatformIOImp.

◆ stop_batch_server()

virtual void geopm::PlatformIO::stop_batch_server ( int  server_pid)
pure virtual

Implemented in geopm::PlatformIOImp.

◆ write_batch()

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

Write all of the pushed controls so that values previously given to adjust() are written to the platform.

Implemented in geopm::PlatformIOImp.

◆ write_control()

virtual void geopm::PlatformIO::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 geopm_domain_e enum described in geopm_topo.h
[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::PlatformIOImp.


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