geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
Public Member Functions | List of all members
geopm::PlatformIOImp Class Reference

#include <PlatformIOImp.hpp>

Inheritance diagram for geopm::PlatformIOImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::PlatformIOImp:
Collaboration graph
[legend]

Public Member Functions

 PlatformIOImp ()
 
 PlatformIOImp (std::list< std::shared_ptr< IOGroup > > iogroup_list, const PlatformTopo &topo)
 
 PlatformIOImp (const PlatformIOImp &other)=delete
 
PlatformIOImpoperator= (const PlatformIOImp &other)=delete
 
virtual ~PlatformIOImp ()=default
 
void register_iogroup (std::shared_ptr< IOGroup > iogroup) override
 Registers an IOGroup with the PlatformIO so that its signals and controls are available through the PlatformIO interface. More...
 
std::set< std::string > signal_names (void) const override
 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...
 
std::set< std::string > control_names (void) const override
 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...
 
int signal_domain_type (const std::string &signal_name) const override
 Query the domain for a named signal. More...
 
int control_domain_type (const std::string &control_name) const override
 Query the domain for a named control. More...
 
int push_signal (const std::string &signal_name, int domain_type, int domain_idx) override
 Push a signal onto the end of the vector that can be sampled. More...
 
int push_control (const std::string &control_name, int domain_type, int domain_idx) override
 Push a control onto the end of the vector that can be adjusted. More...
 
double sample (int signal_idx) override
 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...
 
void adjust (int control_idx, double setting) override
 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...
 
void read_batch (void) override
 Read all pushed signals so that the next call to sample() will reflect the updated data. More...
 
void write_batch (void) override
 Write all of the pushed controls so that values previously given to adjust() are written to the platform. More...
 
double read_signal (const std::string &signal_name, int domain_type, int domain_idx) override
 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...
 
void write_control (const std::string &control_name, int domain_type, int domain_idx, double setting) override
 Interpret the setting and write setting to the platform. Does not modify the values stored by calling adjust(). More...
 
void save_control (void) override
 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...
 
void restore_control (void) override
 Restore all controls to values recorded in previous call to the save_control() method. More...
 
std::function< double(const std::vector< double > &)> agg_function (const std::string &signal_name) const override
 Returns a function appropriate for aggregating multiple values of the given signal into a single value. More...
 
std::function< std::string(double)> format_function (const std::string &signal_name) const override
 Returns a function that can be used to convert a signal of the given name into a printable string. More...
 
std::string signal_description (const std::string &signal_name) const override
 Returns a description of the signal. This string can be used by tools to generate help text for users of PlatformIO. More...
 
std::string control_description (const std::string &control_name) const override
 Returns a description of the control. This string can be used by tools to generate help text for users of PlatformIO. More...
 
int signal_behavior (const std::string &signal_name) const override
 Returns a hint about how a signal will change as a function of time. More...
 
void save_control (const std::string &save_dir) override
 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...
 
void restore_control (const std::string &save_dir) override
 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...
 
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) override
 
void stop_batch_server (int server_pid) override
 
int num_signal_pushed (void) const
 
int num_control_pushed (void) const
 
- Public Member Functions inherited from geopm::PlatformIO
 PlatformIO ()=default
 
virtual ~PlatformIO ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from geopm::PlatformIO
static bool is_valid_value (double value)
 

Constructor & Destructor Documentation

◆ PlatformIOImp() [1/3]

geopm::PlatformIOImp::PlatformIOImp ( )

◆ PlatformIOImp() [2/3]

geopm::PlatformIOImp::PlatformIOImp ( std::list< std::shared_ptr< IOGroup > >  iogroup_list,
const PlatformTopo topo 
)

◆ PlatformIOImp() [3/3]

geopm::PlatformIOImp::PlatformIOImp ( const PlatformIOImp other)
delete

◆ ~PlatformIOImp()

virtual geopm::PlatformIOImp::~PlatformIOImp ( )
virtualdefault

Member Function Documentation

◆ adjust()

void geopm::PlatformIOImp::adjust ( int  control_idx,
double  setting 
)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ agg_function()

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

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.

Implements geopm::PlatformIO.

◆ control_description()

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

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

Implements geopm::PlatformIO.

◆ control_domain_type()

int geopm::PlatformIOImp::control_domain_type ( const std::string &  control_name) const
overridevirtual

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.

Implements geopm::PlatformIO.

◆ control_names()

std::set< std::string > geopm::PlatformIOImp::control_names ( void  ) const
overridevirtual

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

Implements geopm::PlatformIO.

◆ format_function()

std::function< std::string(double)> geopm::PlatformIOImp::format_function ( const std::string &  signal_name) const
overridevirtual

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.

Implements geopm::PlatformIO.

◆ num_control_pushed()

int geopm::PlatformIOImp::num_control_pushed ( void  ) const

◆ num_signal_pushed()

int geopm::PlatformIOImp::num_signal_pushed ( void  ) const

◆ operator=()

PlatformIOImp& geopm::PlatformIOImp::operator= ( const PlatformIOImp other)
delete

◆ push_control()

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

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.

Implements geopm::PlatformIO.

◆ push_signal()

int geopm::PlatformIOImp::push_signal ( const std::string &  signal_name,
int  domain_type,
int  domain_idx 
)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ read_batch()

void geopm::PlatformIOImp::read_batch ( void  )
overridevirtual

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

Implements geopm::PlatformIO.

◆ read_signal()

double geopm::PlatformIOImp::read_signal ( const std::string &  signal_name,
int  domain_type,
int  domain_idx 
)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ register_iogroup()

void geopm::PlatformIOImp::register_iogroup ( std::shared_ptr< IOGroup iogroup)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ restore_control() [1/2]

void geopm::PlatformIOImp::restore_control ( const std::string &  save_dir)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ restore_control() [2/2]

void geopm::PlatformIOImp::restore_control ( void  )
overridevirtual

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

Implements geopm::PlatformIO.

◆ sample()

double geopm::PlatformIOImp::sample ( int  signal_idx)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ save_control() [1/2]

void geopm::PlatformIOImp::save_control ( const std::string &  save_dir)
overridevirtual

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.

Implements geopm::PlatformIO.

◆ save_control() [2/2]

void geopm::PlatformIOImp::save_control ( void  )
overridevirtual

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.

Implements geopm::PlatformIO.

◆ signal_behavior()

int geopm::PlatformIOImp::signal_behavior ( const std::string &  signal_name) const
overridevirtual

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

Implements geopm::PlatformIO.

◆ signal_description()

std::string geopm::PlatformIOImp::signal_description ( const std::string &  signal_name) const
overridevirtual

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

Implements geopm::PlatformIO.

◆ signal_domain_type()

int geopm::PlatformIOImp::signal_domain_type ( const std::string &  signal_name) const
overridevirtual

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.

Implements geopm::PlatformIO.

◆ signal_names()

std::set< std::string > geopm::PlatformIOImp::signal_names ( void  ) const
overridevirtual

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

Implements geopm::PlatformIO.

◆ start_batch_server()

void geopm::PlatformIOImp::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 
)
overridevirtual

Implements geopm::PlatformIO.

◆ stop_batch_server()

void geopm::PlatformIOImp::stop_batch_server ( int  server_pid)
overridevirtual

Implements geopm::PlatformIO.

◆ write_batch()

void geopm::PlatformIOImp::write_batch ( void  )
overridevirtual

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

Implements geopm::PlatformIO.

◆ write_control()

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

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.

Implements geopm::PlatformIO.


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