geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
FrequencyGovernorImp.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 FREQUENCYGOVERNORIMP_HPP_INCLUDE
7 #define FREQUENCYGOVERNORIMP_HPP_INCLUDE
8 
9 #include <memory>
10 #include <vector>
11 #include <string>
12 
14 
15 namespace geopm
16 {
18  {
19  public:
21  FrequencyGovernorImp(PlatformIO &platform_io, const PlatformTopo &platform_topo);
22  virtual ~FrequencyGovernorImp();
23  void init_platform_io(void) override;
24  int frequency_domain_type(void) const override;
25  void set_domain_type(int domain_type) override;
26  void adjust_platform(const std::vector<double> &frequency_request) override;
27  bool do_write_batch(void) const override;
28  bool set_frequency_bounds(double freq_min, double freq_max) override;
29  double get_frequency_min() const override;
30  double get_frequency_max() const override;
31  double get_frequency_step() const override;
32  int get_clamp_count() const override;
33  void validate_policy(double &freq_min, double &freq_max) const override;
34  private:
35  double get_limit(const std::string &sig_name) const;
36  PlatformIO &m_platform_io;
37  const PlatformTopo &m_platform_topo;
38  const double M_FREQ_STEP;
39  const double M_PLAT_FREQ_MIN;
40  const double M_PLAT_FREQ_MAX;
41  double m_freq_min;
42  double m_freq_max;
43  int m_clamp_count;
44  bool m_do_write_batch;
45  int m_freq_ctl_domain_type;
46  std::vector<int> m_control_idx;
47  std::vector<double> m_last_freq;
48  bool m_is_platform_io_initialized;
49  };
50 }
51 
52 #endif
Definition: FrequencyGovernor.hpp:20
Definition: FrequencyGovernorImp.hpp:18
int get_clamp_count() const override
Returns the number of clamping occurrence count for the platform.
Definition: FrequencyGovernor.cpp:188
virtual ~FrequencyGovernorImp()
Definition: FrequencyGovernor.cpp:53
bool set_frequency_bounds(double freq_min, double freq_max) override
Sets min and max package bounds. The defaults before calling this method are the min and max frequenc...
Definition: FrequencyGovernor.cpp:155
void validate_policy(double &freq_min, double &freq_max) const override
Checks that the minimum and maximum frequency are within range for the platform. If not,...
Definition: FrequencyGovernor.cpp:193
void set_domain_type(int domain_type) override
Set the domain type of frequency control that will be used in adjust_platform(). Must be called befor...
Definition: FrequencyGovernor.cpp:100
void adjust_platform(const std::vector< double > &frequency_request) override
Write frequency control, may be clamped between min and max frequency if request cannot be satisfied.
Definition: FrequencyGovernor.cpp:121
void init_platform_io(void) override
Registers signals and controls with PlatformIO using the default control domain.
Definition: FrequencyGovernor.cpp:83
double get_frequency_max() const override
Returns the current max frequency used by the governor.
Definition: FrequencyGovernor.cpp:178
double get_frequency_step() const override
Returns the frequency step for the platform.
Definition: FrequencyGovernor.cpp:183
double get_frequency_min() const override
Returns the current min frequency used by the governor.
Definition: FrequencyGovernor.cpp:173
bool do_write_batch(void) const override
Returns true if last call to adjust_platform requires writing.
Definition: FrequencyGovernor.cpp:150
FrequencyGovernorImp()
Definition: FrequencyGovernor.cpp:31
int frequency_domain_type(void) const override
Get the domain type of frequency control on the platform. Users of the FrequencyGovernor can use this...
Definition: FrequencyGovernor.cpp:95
Definition: Accumulator.cpp:12