Processor Counter Monitor
resctrl.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 // Copyright (c) 2020, Intel Corporation
3 // written by Roman Dementiev
4 
5 #pragma once
6 
11 #ifdef __linux__
12 
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <unordered_map>
16 #include <vector>
17 #include <mutex>
18 #include <memory>
19 
20 namespace pcm
21 {
22  class PCM;
23 
24  class Resctrl
25  {
26  PCM & pcm;
27  typedef std::unordered_map<int, std::vector<std::string> > FileMapType;
28  FileMapType L3OCC, MBL, MBT;
29  Resctrl() = delete;
30  size_t getMetric(const FileMapType & fileMap, int core);
31  static constexpr auto PCMPath = "/sys/fs/resctrl/mon_groups/pcm";
32  public:
33  Resctrl(PCM & m) : pcm(m) {}
34  bool isMounted();
35  void init();
36  size_t getL3OCC(int core);
37  size_t getMBL(int core);
38  size_t getMBT(int core);
39  void cleanup();
40  };
41 };
42 
43  #endif // __linux__
Definition: bw.cpp:12