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);
63 static bool is_all_nan(
const std::vector<double> &vec);
66 M_POLICY_FREQ_CPU_DEFAULT,
67 M_POLICY_FREQ_CPU_UNCORE,
68 M_POLICY_FREQ_GPU_DEFAULT,
70 M_POLICY_FIRST_FREQUENCY,
76 static constexpr
double M_WAIT_SEC = 0.002;
77 PlatformIO &m_platform_io;
78 const PlatformTopo &m_platform_topo;
79 std::vector<int> m_hash_signal_idx;
80 std::vector<int> m_freq_control_idx;
81 int m_gpu_min_control_idx;
82 int m_gpu_max_control_idx;
83 int m_uncore_min_ctl_idx;
84 int m_uncore_max_ctl_idx;
85 std::vector<uint64_t> m_last_hash;
86 std::vector<double> m_last_freq;
87 double m_last_uncore_freq;
88 double m_last_gpu_freq;
90 bool m_is_policy_updated;
91 bool m_do_write_batch;
92 bool m_is_adjust_initialized;
93 bool m_is_real_policy;
94 int m_freq_ctl_domain_type;
95 int m_num_freq_ctl_domain;
97 double m_core_freq_min;
98 double m_core_freq_max;
99 double m_uncore_init_min;
100 double m_uncore_init_max;
101 double m_gpu_init_freq_min;
102 double m_gpu_init_freq_max;
103 double m_default_freq;
104 double m_uncore_freq;
105 double m_default_gpu_freq;
106 std::map<uint64_t, double> m_hash_freq_map;
107 std::set<uint64_t> m_default_freq_hash;
108 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:436
void wait(void) override
Called by Controller to wait for sample period to elapse. This controls the cadence of the Controller...
Definition: FrequencyMapAgent.cpp:358
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:263
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:382
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:346
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:351
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:414
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:258
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:274
static std::unique_ptr< Agent > make_plugin(void)
Definition: FrequencyMapAgent.cpp:86
static std::vector< std::string > policy_names(void)
Definition: FrequencyMapAgent.cpp:363
bool do_send_sample(void) const override
Definition: FrequencyMapAgent.cpp:269
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:387
std::vector< std::string > trace_names(void) const override
Column headers to be added to the trace.
Definition: FrequencyMapAgent.cpp:426
static std::vector< std::string > sample_names(void)
Definition: FrequencyMapAgent.cpp:377
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:431
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:441
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:236
Definition: Accumulator.cpp:12