6 #ifndef SSTIOGROUP_HPP_INCLUDE
7 #define SSTIOGROUP_HPP_INCLUDE
29 std::shared_ptr<SSTIO> sstio,
38 int push_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
39 int push_control(
const std::string &control_name,
int domain_type,
int domain_idx)
override;
42 double sample(
int batch_idx)
override;
43 void adjust(
int batch_idx,
double setting)
override;
44 double read_signal(
const std::string &signal_name,
int domain_type,
int domain_idx)
override;
45 void write_control(
const std::string &control_name,
int domain_type,
int domain_idx,
double setting)
override;
48 std::function<double(
const std::vector<double> &)>
agg_function(
const std::string &signal_name)
const override;
49 std::function<std::string(
double)>
format_function(
const std::string &signal_name)
const override;
53 void save_control(
const std::string &save_path)
override;
55 std::string
name(
void)
const override;
65 struct sst_signal_mailbox_field_s {
73 sst_signal_mailbox_field_s(uint32_t request_data, uint32_t begin_bit,
74 uint32_t end_bit,
double multiplier,
75 int units,
const std::string &description,
77 : sst_signal_mailbox_field_s(
89 sst_signal_mailbox_field_s(uint32_t request_data, uint32_t begin_bit,
90 uint32_t end_bit,
double multiplier,
91 int units,
const std::string &description,
93 std::function<
double(
const std::vector<double> &)>
agg_function)
94 : request_data(request_data)
95 , begin_bit(begin_bit)
97 , multiplier(multiplier)
99 , description(description)
104 uint32_t request_data;
109 std::string description;
111 std::function<double(
const std::vector<double> &)>
agg_function;
113 struct sst_signal_mailbox_raw_s {
118 const std::map<std::string, sst_signal_mailbox_field_s>& fields)
120 , subcommand(subcommand)
126 std::map<std::string, sst_signal_mailbox_field_s> fields;
129 struct sst_control_mailbox_field_s {
130 sst_control_mailbox_field_s(uint32_t write_data, uint32_t begin_bit,
131 uint32_t end_bit,
int units,
132 const std::string &description)
133 : sst_control_mailbox_field_s(
143 sst_control_mailbox_field_s(uint32_t write_data, uint32_t begin_bit,
144 uint32_t end_bit,
int units,
145 const std::string &description,
146 std::function<
double(
const std::vector<double> &)>
agg_function)
147 : write_data(write_data)
148 , begin_bit(begin_bit)
151 , description(description)
159 std::string description;
160 std::function<double(
const std::vector<double> &)>
agg_function;
162 struct sst_control_mailbox_raw_s {
166 sst_control_mailbox_raw_s(
168 const std::map<std::string, sst_control_mailbox_field_s>& fields,
169 uint16_t read_subcommand, uint32_t read_request_data)
171 , subcommand(subcommand)
172 , write_param(write_param)
174 , read_subcommand(read_subcommand)
175 , read_request_data(read_request_data)
180 uint32_t write_param;
181 std::map<std::string, sst_control_mailbox_field_s> fields;
182 uint16_t read_subcommand;
183 uint32_t read_request_data;
186 struct sst_control_mmio_field_s {
187 sst_control_mmio_field_s(uint32_t begin_bit, uint32_t end_bit,
188 double multiplier,
int units,
189 const std::string &description)
190 : sst_control_mmio_field_s(
200 sst_control_mmio_field_s(uint32_t begin_bit, uint32_t end_bit,
201 double multiplier,
int units,
202 const std::string &description,
203 std::function<
double(
const std::vector<double> &)>
agg_function)
204 : begin_bit(begin_bit)
206 , multiplier(multiplier)
208 , description(description)
216 std::string description;
217 std::function<double(
const std::vector<double> &)>
agg_function;
219 struct sst_control_mmio_raw_s {
223 sst_control_mmio_raw_s(
int domain_type, uint32_t register_offset,
224 const std::map<std::string, sst_control_mmio_field_s>& fields)
225 : domain_type(domain_type)
226 , register_offset(register_offset)
231 uint32_t register_offset;
232 std::map<std::string, sst_control_mmio_field_s> fields;
235 struct sst_signal_mmio_field_s {
236 sst_signal_mmio_field_s(uint32_t write_value, uint32_t begin_bit,
237 uint32_t end_bit,
double multiplier,
238 int units,
const std::string &description,
240 : sst_signal_mmio_field_s(
252 sst_signal_mmio_field_s(uint32_t write_value, uint32_t begin_bit,
253 uint32_t end_bit,
double multiplier,
254 int units,
const std::string &description,
256 std::function<
double(
const std::vector<double> &)>
agg_function)
257 : write_value(write_value)
258 , begin_bit(begin_bit)
260 , multiplier(multiplier)
262 , description(description)
267 uint32_t write_value;
272 std::string description;
274 std::function<double(
const std::vector<double> &)>
agg_function;
277 void add_mbox_signals(
const std::string &raw_name,
279 const std::map<std::string, sst_signal_mailbox_field_s> &fields);
280 void add_mbox_controls(
282 uint16_t subcommand, uint32_t write_param,
283 const std::map<std::string, sst_control_mailbox_field_s> &fields,
284 uint16_t read_subcommand, uint32_t read_request_data,
287 void add_mmio_signals(
const std::string &raw_name,
int domain_type,
288 uint32_t register_offset,
289 const std::map<std::string, sst_signal_mmio_field_s> &fields);
290 void add_mmio_controls(
const std::string &raw_name,
int domain_type,
291 uint32_t register_offset,
292 const std::map<std::string, sst_control_mmio_field_s> &fields,
295 static const std::map<std::string, sst_signal_mailbox_raw_s> sst_signal_mbox_info;
296 static const std::map<std::string, sst_control_mailbox_raw_s> sst_control_mbox_info;
297 static const std::map<std::string, sst_control_mmio_raw_s> sst_control_mmio_info;
298 const PlatformTopo &m_topo;
299 std::shared_ptr<SSTIO> m_sstio;
308 std::vector<std::shared_ptr<Signal> > signals;
311 std::function<double(
const std::vector<double> &)>
agg_function;
312 std::string description;
315 std::map<std::string, signal_info> m_signal_available;
319 std::vector<std::shared_ptr<Control> > controls;
322 std::function<double(
const std::vector<double> &)>
agg_function;
323 std::string description;
325 std::map<std::string, control_info> m_control_available;
328 std::vector<std::shared_ptr<Signal> > m_signal_pushed;
331 std::vector<std::shared_ptr<Control> > m_control_pushed;
333 std::shared_ptr<SaveControl> m_mock_save_ctl;
Definition: IOGroup.hpp:21
m_signal_behavior_e
Description of the runtime behavior of a signal.
Definition: IOGroup.hpp:36
IOGroup that provides a signal for the time since GEOPM startup.
Definition: SSTIOGroup.hpp:25
void write_batch(void) override
Write all of the pushed controls so that values previously given to adjust() are written to the platf...
Definition: SSTIOGroup.cpp:477
void restore_control(void) override
Restore all controls to values recorded in previous call to the save() method.
Definition: SSTIOGroup.cpp:558
int signal_behavior(const std::string &signal_name) const override
Returns a hint about how a signal will change as a function of time.
Definition: SSTIOGroup.cpp:645
static std::string plugin_name(void)
Definition: SSTIOGroup.cpp:572
int signal_domain_type(const std::string &signal_name) const override
Query the domain for a named signal.
Definition: SSTIOGroup.cpp:388
std::function< double(const std::vector< double > &)> agg_function(const std::string &signal_name) const override
Return a function that should be used when aggregating the given signal.
Definition: SSTIOGroup.cpp:582
void save_control(void) override
Save the state of all controls so that any subsequent changes made through the IOGroup can be undone ...
Definition: SSTIOGroup.cpp:535
std::set< std::string > control_names(void) const override
Returns the names of all controls provided by the IOGroup.
Definition: SSTIOGroup.cpp:369
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...
Definition: SSTIOGroup.cpp:607
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 user...
Definition: SSTIOGroup.cpp:626
void read_batch(void) override
Read all pushed signals from the platform so that the next call to sample() will reflect the updated ...
Definition: SSTIOGroup.cpp:471
SSTIOGroup()
Definition: SSTIOGroup.cpp:236
int push_control(const std::string &control_name, int domain_type, int domain_idx) override
Add a control to the list of controls that is written by write_batch() and configured with adjust().
Definition: SSTIOGroup.cpp:436
int control_domain_type(const std::string &control_name) const override
Query the domain for a named control.
Definition: SSTIOGroup.cpp:398
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...
Definition: SSTIOGroup.cpp:518
SSTMailboxCommand
Definition: SSTIOGroup.hpp:59
static std::unique_ptr< IOGroup > make_plugin(void)
Definition: SSTIOGroup.cpp:577
int push_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Add a signal to the list of signals that is read by read_batch() and sampled by sample().
Definition: SSTIOGroup.cpp:408
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....
Definition: SSTIOGroup.cpp:593
virtual ~SSTIOGroup()=default
std::string name(void) const override
Get the IOGroup name.
Definition: SSTIOGroup.cpp:567
void adjust(int batch_idx, double setting) override
Adjust a setting for a particular control that was previously pushed with push_control()....
Definition: SSTIOGroup.cpp:496
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....
Definition: SSTIOGroup.cpp:501
double sample(int batch_idx) override
Retrieve signal value from data read by last call to read_batch() for a particular signal previously ...
Definition: SSTIOGroup.cpp:482
std::set< std::string > signal_names(void) const override
Returns the names of all signals provided by the IOGroup.
Definition: SSTIOGroup.cpp:360
bool is_valid_control(const std::string &control_name) const override
Test if control_name refers to a control supported by the group.
Definition: SSTIOGroup.cpp:383
bool is_valid_signal(const std::string &signal_name) const override
Test if signal_name refers to a signal supported by the group.
Definition: SSTIOGroup.cpp:378