geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
EpochIOGroup.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef EPOCHIOGROUP_HPP_INCLUDE
7 #define EPOCHIOGROUP_HPP_INCLUDE
8 
9 #include <memory>
10 
11 #include "geopm/IOGroup.hpp"
12 
13 namespace geopm
14 {
15  class PlatformTopo;
16  class ApplicationSampler;
17 
18  class EpochIOGroup : public IOGroup
19  {
20  public:
21  EpochIOGroup();
22  EpochIOGroup(const PlatformTopo &topo,
23  ApplicationSampler &app);
24  virtual ~EpochIOGroup() = default;
25  std::set<std::string> signal_names(void) const override;
26  std::set<std::string> control_names(void) const override;
27  bool is_valid_signal(const std::string &signal_name) const override;
28  bool is_valid_control(const std::string &control_name) const override;
29  int signal_domain_type(const std::string &signal_name) const override;
30  int control_domain_type(const std::string &control_name) const override;
31  int push_signal(const std::string &signal_name, int domain_type, int domain_idx) override;
32  int push_control(const std::string &control_name, int domain_type, int domain_idx) override;
33  void read_batch(void) override;
34  void write_batch(void) override;
35  double sample(int batch_idx) override;
36  void adjust(int batch_idx, double setting) override;
37  double read_signal(const std::string &signal_name, int domain_type, int domain_idx) override;
38  void write_control(const std::string &control_name, int domain_type, int domain_idx, double setting) override;
39  void save_control(void) override;
40  void restore_control(void) override;
41  std::function<double(const std::vector<double> &)> agg_function(const std::string &signal_name) const override;
42  std::function<std::string(double)> format_function(const std::string &signal_name) const override;
43  std::string signal_description(const std::string &signal_name) const override;
44  std::string control_description(const std::string &control_name) const override;
45  int signal_behavior(const std::string &signal_name) const override;
46  void save_control(const std::string &save_path) override;
47  void restore_control(const std::string &save_path) override;
48  std::string name(void) const override;
49  static std::string plugin_name(void);
50  static std::unique_ptr<IOGroup> make_plugin(void);
51  private:
52  static const std::set<std::string> m_valid_signal_name;
53  void check_domain(int domain_type, int domain_idx) const;
54  void check_signal_name(const std::string &signal_name) const;
55 
56  const PlatformTopo &m_topo;
57  const ApplicationSampler &m_app;
58  int m_num_cpu;
59  std::vector<double> m_per_cpu_count;
60  bool m_is_batch_read;
61  std::map<int, int> m_cpu_signal_map;
62  std::vector<int> m_active_signal;
63  };
64 }
65 
66 #endif
Definition: ApplicationSampler.hpp:27
Definition: EpochIOGroup.hpp:19
int push_control(const std::string &control_name, int domain_type, int domain_idx) override
Definition: EpochIOGroup.cpp:105
std::set< std::string > control_names(void) const override
Definition: EpochIOGroup.cpp:49
void write_batch(void) override
Definition: EpochIOGroup.cpp:136
int signal_behavior(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:240
void write_control(const std::string &control_name, int domain_type, int domain_idx, double setting) override
Definition: EpochIOGroup.cpp:173
int push_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Definition: EpochIOGroup.cpp:78
double read_signal(const std::string &signal_name, int domain_type, int domain_idx) override
Definition: EpochIOGroup.cpp:167
virtual ~EpochIOGroup()=default
std::function< std::string(double)> format_function(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:214
int control_domain_type(const std::string &control_name) const override
Definition: EpochIOGroup.cpp:73
std::function< double(const std::vector< double > &)> agg_function(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:204
void restore_control(void) override
Definition: EpochIOGroup.cpp:184
bool is_valid_signal(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:54
EpochIOGroup()
Definition: EpochIOGroup.cpp:26
static std::string plugin_name(void)
Definition: EpochIOGroup.cpp:194
double sample(int batch_idx) override
Definition: EpochIOGroup.cpp:141
int signal_domain_type(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:64
void adjust(int batch_idx, double setting) override
Definition: EpochIOGroup.cpp:161
static std::unique_ptr< IOGroup > make_plugin(void)
Definition: EpochIOGroup.cpp:199
void read_batch(void) override
Definition: EpochIOGroup.cpp:111
std::string control_description(const std::string &control_name) const override
Definition: EpochIOGroup.cpp:234
std::string name(void) const override
Definition: EpochIOGroup.cpp:189
std::string signal_description(const std::string &signal_name) const override
Definition: EpochIOGroup.cpp:224
std::set< std::string > signal_names(void) const override
Definition: EpochIOGroup.cpp:44
void save_control(void) override
Definition: EpochIOGroup.cpp:179
bool is_valid_control(const std::string &control_name) const override
Definition: EpochIOGroup.cpp:59
Definition: Accumulator.cpp:12