6 #ifndef SERVICEIOGROUP_HPP_INCLUDE
7 #define SERVICEIOGROUP_HPP_INCLUDE
21 struct control_info_s;
31 std::shared_ptr<ServiceProxy> service_proxy,
32 std::shared_ptr<BatchClient> batch_client_mock);
44 int domain_idx)
override;
47 int domain_idx)
override;
50 double sample(
int sample_idx)
override;
51 void adjust(
int control_idx,
52 double setting)
override;
55 int domain_idx)
override;
59 double setting)
override;
67 std::function<double(
const std::vector<double> &)>
agg_function(
const std::string &signal_name)
const override;
68 std::function<std::string(
double)>
format_function(
const std::string &signal_name)
const override;
72 void save_control(
const std::string &save_path)
override;
74 std::string
name(
void)
const override;
78 void init_batch_server(
void);
79 static const std::string M_PLUGIN_NAME;
80 static std::map<std::string, signal_info_s> service_signal_info(std::shared_ptr<ServiceProxy> service_proxy);
81 static std::map<std::string, control_info_s> service_control_info(std::shared_ptr<ServiceProxy> service_proxy);
82 static std::string strip_plugin_name(
const std::string &
name);
84 std::shared_ptr<ServiceProxy> m_service_proxy;
85 std::map<std::string, signal_info_s> m_signal_info;
86 std::map<std::string, control_info_s> m_control_info;
87 std::vector<geopm_request_s> m_signal_requests;
88 std::vector<geopm_request_s> m_control_requests;
89 std::shared_ptr<BatchClient> m_batch_client;
90 std::vector<double> m_batch_samples;
91 std::vector<double> m_batch_settings;
93 bool m_is_batch_active;
Definition: IOGroup.hpp:21
IOGroup that uses DBus interface to access geopmd provided signals and controls. This IOGroup is not ...
Definition: ServiceIOGroup.hpp:27
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: ServiceIOGroup.cpp:273
void write_batch(void) override
Write all of the pushed controls so that values previously given to adjust() are written to the platf...
Definition: ServiceIOGroup.cpp:212
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: ServiceIOGroup.cpp:317
bool is_valid_signal(const std::string &signal_name) const override
Test if signal_name refers to a signal supported by the group.
Definition: ServiceIOGroup.cpp:111
void adjust(int control_idx, double setting) override
Adjust a setting for a particular control that was previously pushed with push_control()....
Definition: ServiceIOGroup.cpp:237
virtual ~ServiceIOGroup()
Definition: ServiceIOGroup.cpp:48
std::set< std::string > control_names(void) const override
Returns the names of all controls provided by the IOGroup.
Definition: ServiceIOGroup.cpp:102
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: ServiceIOGroup.cpp:252
void read_batch(void) override
Read all pushed signals from the platform so that the next call to sample() will reflect the updated ...
Definition: ServiceIOGroup.cpp:203
void restore_control(void) override
Restore all controls to values recorded in previous call to the save() method.
Definition: ServiceIOGroup.cpp:301
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: ServiceIOGroup.cpp:141
bool is_valid_control(const std::string &control_name) const override
Test if control_name refers to a control supported by the group.
Definition: ServiceIOGroup.cpp:116
ServiceIOGroup()
Definition: ServiceIOGroup.cpp:25
int signal_domain_type(const std::string &signal_name) const override
Query the domain for a named signal.
Definition: ServiceIOGroup.cpp:121
ServiceIOGroup(const ServiceIOGroup &other)=delete
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: ServiceIOGroup.cpp:172
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: ServiceIOGroup.cpp:350
int control_domain_type(const std::string &control_name) const override
Query the domain for a named control.
Definition: ServiceIOGroup.cpp:131
static std::string plugin_name(void)
Definition: ServiceIOGroup.cpp:410
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: ServiceIOGroup.cpp:306
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: ServiceIOGroup.cpp:339
std::string name(void) const override
Get the IOGroup name.
Definition: ServiceIOGroup.cpp:405
void save_control(void) override
Save the state of all controls so that any subsequent changes made through the IOGroup can be undone ...
Definition: ServiceIOGroup.cpp:295
std::set< std::string > signal_names(void) const override
Returns the names of all signals provided by the IOGroup.
Definition: ServiceIOGroup.cpp:93
static std::unique_ptr< IOGroup > make_plugin(void)
Definition: ServiceIOGroup.cpp:415
double sample(int sample_idx) override
Retrieve signal value from data read by last call to read_batch() for a particular signal previously ...
Definition: ServiceIOGroup.cpp:220
ServiceIOGroup & operator=(const ServiceIOGroup &other)=delete
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: ServiceIOGroup.cpp:328
const PlatformTopo & platform_topo(void)
Definition: PlatformTopo.cpp:81
Definition: geopm_pio.h:387