6 #ifndef AGENT_HPP_INCLUDE
7 #define AGENT_HPP_INCLUDE
14 #include "geopm/PluginFactory.hpp"
15 #include "geopm_public.h"
24 static std::vector<std::string> agent_names(
void);
25 static std::unique_ptr<Agent> make_unique(
const std::string &agent_name);
37 virtual void init(
int level,
const std::vector<int> &fan_in,
bool is_level_root) = 0;
55 std::vector<std::vector<double> > &out_policy) = 0;
67 std::vector<double> &out_sample) = 0;
88 virtual void wait(
void) = 0;
91 virtual std::vector<std::pair<std::string, std::string> >
report_header(
void)
const = 0;
93 virtual std::vector<std::pair<std::string, std::string> >
report_host(
void)
const = 0;
95 virtual std::map<uint64_t, std::vector<std::pair<std::string, std::string> > >
report_region(
void)
const = 0;
99 virtual std::vector<std::function<std::string(
double)> > trace_formats(
void)
const;
114 static int num_policy(
const std::map<std::string, std::string> &dictionary);
119 static int num_policy(
const std::string &agent_name);
127 static int num_sample(
const std::map<std::string, std::string> &dictionary);
132 static int num_sample(
const std::string &agent_name);
140 static std::vector<std::string> policy_names(
const std::map<std::string, std::string> &dictionary);
145 static std::vector<std::string> policy_names(
const std::string &agent_name);
153 static std::vector<std::string> sample_names(
const std::map<std::string, std::string> &dictionary);
158 static std::vector<std::string> sample_names(
const std::string &agent_name);
165 static std::map<std::string, std::string> make_dictionary(
const std::vector<std::string> &policy_names,
166 const std::vector<std::string> &sample_names);
179 static void aggregate_sample(
const std::vector<std::vector<double> > &in_sample,
180 const std::vector<std::function<
double(
const std::vector<double>&)> > &agg_func,
181 std::vector<double> &out_sample);
184 static const std::string m_num_sample_string;
185 static const std::string m_num_policy_string;
186 static const std::string m_sample_prefix;
187 static const std::string m_policy_prefix;
Definition: Agent.hpp:191
virtual ~AgentFactory()=default
virtual bool do_send_sample(void) const =0
virtual void wait(void)=0
Called by Controller to wait for sample period to elapse. This controls the cadence of the Controller...
virtual void sample_platform(std::vector< double > &out_sample)=0
Read signals from the platform and interpret/aggregate these signals to create a sample which can be ...
virtual void init(int level, const std::vector< int > &fan_in, bool is_level_root)=0
Set the level where this Agent is active and push signals/controls for that level.
virtual void split_policy(const std::vector< double > &in_policy, std::vector< std::vector< double > > &out_policy)=0
Called by Controller to split policy for children at next level down the tree.
virtual void aggregate_sample(const std::vector< std::vector< double > > &in_sample, std::vector< double > &out_sample)=0
Aggregate samples from children for the next level up the tree.
virtual void adjust_platform(const std::vector< double > &in_policy)=0
Adjust the platform settings based the policy from above.
virtual void validate_policy(std::vector< double > &policy) const =0
Called by Controller to validate incoming policy values and configure defaults requested in incoming ...
virtual std::map< uint64_t, std::vector< std::pair< std::string, std::string > > > report_region(void) const =0
Custom fields for each region in the report.
virtual std::vector< std::string > trace_names(void) const =0
Column headers to be added to the trace.
virtual std::vector< std::pair< std::string, std::string > > report_host(void) const =0
Custom fields for the host section of the report.
virtual bool do_send_policy(void) const =0
Called by Controller to determine if new policy values should be sent down the tree to the Agent's ch...
static const std::string M_PLUGIN_PREFIX
Definition: Agent.hpp:182
virtual void trace_values(std::vector< double > &values)=0
Called by Controller to get latest values to be added to the trace.
virtual std::vector< std::pair< std::string, std::string > > report_header(void) const =0
Custom fields that will be added to the report header when this agent is used.
virtual void enforce_policy(const std::vector< double > &policy) const =0
Enforce the policy one time with PlatformIO::write_control(). Called to enforce static policies in th...
virtual bool do_write_batch(void) const =0
Called by the Controller to decide whether to call write_batch() to update platform controls.
Definition: Accumulator.cpp:12
AgentFactory & agent_factory(void)
Definition: Agent.cpp:76