6#ifndef FREQUENCYMAPAGENT_HPP_INCLUDE
7#define FREQUENCYMAPAGENT_HPP_INCLUDE
29 std::shared_ptr<Waiter> waiter);
31 std::shared_ptr<Waiter> waiter,
32 const std::map<uint64_t, double>& hash_freq_map,
33 const std::set<uint64_t>& default_freq_hash);
35 void init(
int level,
const std::vector<int> &fan_in,
bool is_level_root)
override;
38 std::vector<std::vector<double> > &out_policy)
override;
41 std::vector<double> &out_sample)
override;
46 void wait(
void)
override;
47 std::vector<std::pair<std::string, std::string> >
report_header(
void)
const override;
48 std::vector<std::pair<std::string, std::string> >
report_host(
void)
const override;
49 std::map<uint64_t, std::vector<std::pair<std::string, std::string> > >
report_region(
void)
const override;
50 std::vector<std::string>
trace_names(
void)
const override;
51 std::vector<std::function<std::string(
double)> >
trace_formats(
void)
const override;
53 void enforce_policy(
const std::vector<double> &policy)
const override;
61 void update_policy(
const std::vector<double> &policy);
62 void init_platform_io(
void);
65 M_POLICY_FREQ_CPU_DEFAULT,
66 M_POLICY_FREQ_CPU_UNCORE,
67 M_POLICY_FREQ_GPU_DEFAULT,
69 M_POLICY_FIRST_FREQUENCY,
75 static constexpr double M_WAIT_SEC = 0.002;
76 PlatformIO &m_platform_io;
77 const PlatformTopo &m_platform_topo;
78 std::vector<int> m_hash_signal_idx;
79 std::vector<int> m_freq_control_idx;
80 int m_gpu_min_control_idx;
81 int m_gpu_max_control_idx;
82 int m_uncore_min_ctl_idx;
83 int m_uncore_max_ctl_idx;
84 std::vector<uint64_t> m_last_hash;
85 std::vector<double> m_last_freq;
86 double m_last_uncore_freq;
87 double m_last_gpu_freq;
89 bool m_is_policy_updated;
90 bool m_do_write_batch;
91 bool m_is_adjust_initialized;
92 bool m_is_real_policy;
93 int m_freq_ctl_domain_type;
94 int m_num_freq_ctl_domain;
96 double m_core_freq_min;
97 double m_core_freq_max;
98 double m_uncore_init_min;
99 double m_uncore_init_max;
100 double m_gpu_init_freq_min;
101 double m_gpu_init_freq_max;
102 double m_default_freq;
103 double m_uncore_freq;
104 double m_default_gpu_freq;
105 std::map<uint64_t, double> m_hash_freq_map;
106 std::set<uint64_t> m_default_freq_hash;
107 std::shared_ptr<Waiter> m_waiter;
Definition FrequencyMapAgent.hpp:25
void trace_values(std::vector< double > &values) override
Called by Controller to get latest values to be added to the trace.
Definition FrequencyMapAgent.cpp:430
void wait(void) override
Called by Controller to wait for sample period to elapse. This controls the cadence of the Controller...
Definition FrequencyMapAgent.cpp:352
virtual ~FrequencyMapAgent()=default
void aggregate_sample(const std::vector< std::vector< double > > &in_sample, std::vector< double > &out_sample) override
Aggregate samples from children for the next level up the tree.
Definition FrequencyMapAgent.cpp:257
std::vector< std::pair< std::string, std::string > > report_header(void) const override
Custom fields that will be added to the report header when this agent is used.
Definition FrequencyMapAgent.cpp:376
bool do_write_batch(void) const override
Called by the Controller to decide whether to call write_batch() to update platform controls.
Definition FrequencyMapAgent.cpp:340
void sample_platform(std::vector< double > &out_sample) override
Read signals from the platform and interpret/aggregate these signals to create a sample which can be ...
Definition FrequencyMapAgent.cpp:345
std::map< uint64_t, std::vector< std::pair< std::string, std::string > > > report_region(void) const override
Custom fields for each region in the report.
Definition FrequencyMapAgent.cpp:408
bool do_send_policy(void) const override
Called by Controller to determine if new policy values should be sent down the tree to the Agent's ch...
Definition FrequencyMapAgent.cpp:252
void validate_policy(std::vector< double > &policy) const override
Called by Controller to validate incoming policy values and configure defaults requested in incoming ...
Definition FrequencyMapAgent.cpp:102
void adjust_platform(const std::vector< double > &in_policy) override
Adjust the platform settings based the policy from above.
Definition FrequencyMapAgent.cpp:268
static std::unique_ptr< Agent > make_plugin(void)
Definition FrequencyMapAgent.cpp:86
static std::vector< std::string > policy_names(void)
Definition FrequencyMapAgent.cpp:357
bool do_send_sample(void) const override
Definition FrequencyMapAgent.cpp:263
std::vector< std::pair< std::string, std::string > > report_host(void) const override
Custom fields for the host section of the report.
Definition FrequencyMapAgent.cpp:381
std::vector< std::string > trace_names(void) const override
Column headers to be added to the trace.
Definition FrequencyMapAgent.cpp:420
static std::vector< std::string > sample_names(void)
Definition FrequencyMapAgent.cpp:371
FrequencyMapAgent()
Definition FrequencyMapAgent.cpp:31
std::vector< std::function< std::string(double)> > trace_formats(void) const override
Returns format string for each column added to the trace.
Definition FrequencyMapAgent.cpp:425
void enforce_policy(const std::vector< double > &policy) const override
Enforce the policy one time with PlatformIO::write_control(). Called to enforce static policies in th...
Definition FrequencyMapAgent.cpp:435
static std::string plugin_name(void)
Definition FrequencyMapAgent.cpp:81
void init(int level, const std::vector< int > &fan_in, bool is_level_root) override
Set the level where this Agent is active and push signals/controls for that level.
Definition FrequencyMapAgent.cpp:91
void split_policy(const std::vector< double > &in_policy, std::vector< std::vector< double > > &out_policy) override
Called by Controller to split policy for children at next level down the tree.
Definition FrequencyMapAgent.cpp:230
Definition Accumulator.cpp:12