geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
CpufreqSysfsDriver.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 CPUFREQSYSFSDRIVER_HPP_INCLUDE
7 #define CPUFREQSYSFSDRIVER_HPP_INCLUDE
8 
9 #include <map>
10 #include <vector>
11 
12 #include "geopm_topo.h"
13 
14 #include "SysfsDriver.hpp"
15 
16 namespace geopm
17 {
18  class IOGroup;
19  class PlatformTopo;
20 
23  {
24  public:
26  CpufreqSysfsDriver(const PlatformTopo &topo,
27  const std::string &cpufreq_directory);
28  virtual ~CpufreqSysfsDriver() = default;
29  int domain_type(const std::string &name) const override;
30  std::string attribute_path(const std::string &name,
31  int domain_idx) override;
32  std::function<double(const std::string&)> signal_parse(const std::string &signal_name) const override;
33  std::function<std::string(double)> control_gen(const std::string &control_name) const override;
34  std::string driver(void) const override;
35  std::map<std::string, SysfsDriver::properties_s> properties(void) const override;
36  static std::string plugin_name(void);
37  static std::unique_ptr<IOGroup> make_plugin(void);
38  private:
39  const std::map<std::string, SysfsDriver::properties_s> M_PROPERTIES;
40  const std::map<std::string, std::vector<int> > M_CPUFREQ_CPUS_BY_RESOURCE;
41  const std::map<int, std::string> M_CPUFREQ_RESOURCE_BY_CPU;
42  geopm_domain_e m_domain;
43  const geopm::PlatformTopo &m_topo;
44  };
45 }
46 
47 #endif
Class used to implement the CpufreqSysfsDriverGroup.
Definition: CpufreqSysfsDriver.hpp:23
virtual ~CpufreqSysfsDriver()=default
std::function< std::string(double)> control_gen(const std::string &control_name) const override
Get a function to convert a control into a sysfs string.
Definition: CpufreqSysfsDriver.cpp:190
std::map< std::string, SysfsDriver::properties_s > properties(void) const override
Query the meta data about a signal or control.
Definition: CpufreqSysfsDriver.cpp:208
std::string driver(void) const override
Definition: CpufreqSysfsDriver.cpp:203
int domain_type(const std::string &name) const override
Get the PlatformTopo domain type for an named attribute.
Definition: CpufreqSysfsDriver.cpp:134
CpufreqSysfsDriver()
Definition: CpufreqSysfsDriver.cpp:93
std::function< double(const std::string &)> signal_parse(const std::string &signal_name) const override
Get function to convert contents of sysfs file into signal.
Definition: CpufreqSysfsDriver.cpp:171
static std::unique_ptr< IOGroup > make_plugin(void)
Definition: CpufreqSysfsDriver.cpp:218
std::string attribute_path(const std::string &name, int domain_idx) override
Get the path to the sysfs entry for signal.
Definition: CpufreqSysfsDriver.cpp:139
static std::string plugin_name(void)
Definition: CpufreqSysfsDriver.cpp:213
Definition: PlatformTopo.hpp:28
Class used to implement the SysfsIOGroup base class.
Definition: SysfsDriver.hpp:23
geopm_domain_e
Definition: geopm_topo.h:17
Definition: Agg.cpp:20