geopm
3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
|
Class that enables the save/restore feature for IOGroups. More...
#include <SaveControl.hpp>
Classes | |
struct | m_setting_s |
Structure that holds the parameters passed to the IOGroup::write_control() method. More... | |
Public Member Functions | |
SaveControl ()=default | |
virtual | ~SaveControl ()=default |
virtual std::string | json (void) const =0 |
Get saved control settings JSON. More... | |
virtual std::vector< m_setting_s > | settings (void) const =0 |
Get saved control settings structures. More... | |
virtual void | write_json (const std::string &save_path) const =0 |
Write the JSON formatted settings to a file. More... | |
virtual void | restore (IOGroup &io_group) const =0 |
Write all of the control settings to the platform. More... | |
virtual std::set< std::string > | unsaved_controls (const std::set< std::string > &all_controls) const =0 |
Static Public Member Functions | |
static std::unique_ptr< SaveControl > | make_unique (const std::vector< m_setting_s > &settings) |
Create a unique pointer to SaveControl object from a vector of setting structures. More... | |
static std::unique_ptr< SaveControl > | make_unique (const std::string &json_string) |
Create a unique pointer to SaveControl object from a JSON formatted string. More... | |
static std::unique_ptr< SaveControl > | make_unique (IOGroup &io_group) |
Create a unique pointer to SaveControl object by querying an IOGroup. More... | |
Class that enables the save/restore feature for IOGroups.
This is a helper class that can be used by IOGroups to enable control settings to be stored to and loaded from disk in JSON format. Additionally it can write all the settings to facilitate the restore.
The JSON format for the data structure is a list of maps. Each map represents a m_setting_s structure by mapping a string naming the structure field to the value. An example JSON string follows
[{"name": "MSR::PERF_CTL:FREQ", "domain_type": 2, "domain_idx": 0, "setting": 2.4e9}, {"name": "MSR::PERF_CTL:FREQ", "domain_type": 2, "domain_idx": 1, "setting": 2.4e9}]
|
default |
|
virtualdefault |
|
pure virtual |
Get saved control settings JSON.
Implemented in geopm::SaveControlImp.
|
static |
Create a unique pointer to SaveControl object from a JSON formatted string.
json_string | [in] A JSON representation of a vector of m_setting_s structures. |
|
static |
Create a unique pointer to SaveControl object from a vector of setting structures.
This method enables the construction when the user wants explicit control of the setting parameters.
settings | Vector of setting structures for all controls to be restored |
|
static |
Create a unique pointer to SaveControl object by querying an IOGroup.
A list of all low level control names is determined based on the control_names() return values that are within the IOGroup namespace. The corresponding signal is read for all these low level controls at their native domain. The values that are read are stored in the SaveControl object that is returned.
io_group | [in] An IOGroup that implements controls |
|
pure virtual |
Write all of the control settings to the platform.
Make a sequence of calls to io_group.write_control() with the parameters returned by the settings() method.
io_group | [in] An IOGroup that implements controls |
Implemented in geopm::SaveControlImp.
|
pure virtual |
Get saved control settings structures.
Implemented in geopm::SaveControlImp.
|
pure virtual |
Implemented in geopm::SaveControlImp.
|
pure virtual |
Write the JSON formatted settings to a file.
Writes the string to the specified output file. The file is overwritten if it already exists. An exception is raised if the directory containing the output does not exist, or if the file cannot be created for any other reason.
save_path | [in] The file path where the JSON string is written. |
Implemented in geopm::SaveControlImp.