geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
PlatformTopo.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 
7 #ifndef PLATFORMTOPO_HPP_INCLUDE
8 #define PLATFORMTOPO_HPP_INCLUDE
9 
10 #include <map>
11 #include <set>
12 #include <string>
13 #include <vector>
14 
15 #include "geopm_public.h"
16 #include "geopm_topo.h"
17 
18 extern "C"
19 {
21  int GEOPM_PUBLIC
22  geopm_read_cpuid(void);
23 }
24 
25 namespace geopm
26 {
28  {
29  public:
30  PlatformTopo() = default;
31  virtual ~PlatformTopo() = default;
34  virtual int num_domain(int domain_type) const = 0;
38  virtual int domain_idx(int domain_type,
39  int cpu_idx) const = 0;
48  virtual bool is_nested_domain(int inner_domain, int outer_domain) const = 0;
61  virtual std::set<int> domain_nested(int inner_domain, int outer_domain, int outer_idx) const = 0;
71  static std::string domain_type_to_name(int domain_type);
79  static int domain_name_to_type(const std::string &domain_name);
82  static void create_cache(void);
83  private:
84  static std::vector<std::string> domain_names(void);
85  static std::map<std::string, int> domain_types(void);
86  };
87 
89  platform_topo(void);
90 }
91 #endif
int GEOPM_PUBLIC geopm_read_cpuid(void)
Identify host CPU.
Definition: PlatformTopo.cpp:36
Definition: PlatformTopo.hpp:28
virtual std::set< int > domain_nested(int inner_domain, int outer_domain, int outer_idx) const =0
Get the set of smaller domains contained in a larger one. If the inner domain is not the same as or c...
virtual int domain_idx(int domain_type, int cpu_idx) const =0
Get the domain index for a particular domain type that contains the given Linux logical CPU index.
virtual int num_domain(int domain_type) const =0
Number of domains on the platform of a particular geopm_domain_e type.
virtual ~PlatformTopo()=default
virtual bool is_nested_domain(int inner_domain, int outer_domain) const =0
Check if one domain type is contained in another.
PlatformTopo()=default
#define GEOPM_PUBLIC
Definition: geopm_public.h:10
Definition: Agg.cpp:20
const PlatformTopo & platform_topo(void)
Definition: PlatformTopo.cpp:81