ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllMemoryTracker.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllMemoryTracker.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef FUN4ALL_FUN4ALLMEMORYTRACKER_H
4 #define FUN4ALL_FUN4ALLMEMORYTRACKER_H
5 
6 #include "Fun4AllBase.h"
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
13 {
14  public:
16  {
17  if (mInstance) return mInstance;
19  return mInstance;
20  }
21  ~Fun4AllMemoryTracker() override;
22  void Snapshot(const std::string &trackername, const std::string &group = "");
23  void Start(const std::string &trackername, const std::string &group = "");
24  void Stop(const std::string &trackername, const std::string &group = "");
25 
26  int GetRSSMemory() const;
27  void PrintMemoryTracker(const std::string &name = "") const;
28  std::vector<int> GetMemoryVector(const std::string &name) const;
29 
30  private:
32  std::string CreateFullTrackerName(const std::string &trackername, const std::string &group = "");
34  std::map<std::string, std::vector<int>> mMemoryTrackerMap;
35  std::map<std::string, int> mStartMem;
36 };
37 
38 #endif