geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
FrequencyGovernor.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 FREQUENCYGOVERNOR_HPP_INCLUDE
7 #define FREQUENCYGOVERNOR_HPP_INCLUDE
8 
9 #include <memory>
10 #include <vector>
11 
12 #include "geopm_public.h"
13 
14 namespace geopm
15 {
16  class PlatformIO;
17  class PlatformTopo;
18 
19  class GEOPM_PUBLIC FrequencyGovernor
20  {
21  public:
22  FrequencyGovernor() = default;
23  virtual ~FrequencyGovernor() = default;
26  virtual void init_platform_io(void) = 0;
32  virtual int frequency_domain_type(void) const = 0;
40  virtual void set_domain_type(int domain_type) = 0;
45  virtual void adjust_platform(const std::vector<double> &frequency_request) = 0;
47  // of controls.
49  virtual bool do_write_batch(void) const = 0;
55  virtual bool set_frequency_bounds(double freq_min, double freq_max) = 0;
58  virtual double get_frequency_min() const = 0;
61  virtual double get_frequency_max() const = 0;
64  virtual double get_frequency_step() const = 0;
67  virtual int get_clamp_count() const = 0;
76  virtual void validate_policy(double &freq_min, double &freq_max) const = 0;
79  static std::unique_ptr<FrequencyGovernor> make_unique(void);
82  static std::shared_ptr<FrequencyGovernor> make_shared(void);
83  };
84 }
85 
86 #endif
Definition: FrequencyGovernor.hpp:20
virtual ~FrequencyGovernor()=default
virtual void validate_policy(double &freq_min, double &freq_max) const =0
Checks that the minimum and maximum frequency are within range for the platform. If not,...
virtual double get_frequency_step() const =0
Returns the frequency step for the platform.
virtual int frequency_domain_type(void) const =0
Get the domain type of frequency control on the platform. Users of the FrequencyGovernor can use this...
virtual bool set_frequency_bounds(double freq_min, double freq_max)=0
Sets min and max package bounds. The defaults before calling this method are the min and max frequenc...
virtual void init_platform_io(void)=0
Registers signals and controls with PlatformIO using the default control domain.
virtual void set_domain_type(int domain_type)=0
Set the domain type of frequency control that will be used in adjust_platform(). Must be called befor...
virtual double get_frequency_max() const =0
Returns the current max frequency used by the governor.
virtual void adjust_platform(const std::vector< double > &frequency_request)=0
Write frequency control, may be clamped between min and max frequency if request cannot be satisfied.
virtual bool do_write_batch(void) const =0
Returns true if last call to adjust_platform requires writing.
virtual double get_frequency_min() const =0
Returns the current min frequency used by the governor.
virtual int get_clamp_count() const =0
Returns the number of clamping occurrence count for the platform.
Definition: Accumulator.cpp:12