ATLAS Offline Software
DataModel.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // DataModel.h
8 // Header file for class(es) of the PerfMon DataModel
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef PERFMONEVENT_DATAMODEL_H
12 #define PERFMONEVENT_DATAMODEL_H
13 
14 // STL includes
15 #include <time.h>
16 #include "PerfMonEvent/mallinfo.h"
17 
18 // PerfMonEvent includes
19 
20 // Forward declaration
21 
22 namespace PerfMon {
23 
24  inline
25  float rt_cpu()
26  {
27 #if !defined(__APPLE__)
28  struct timespec res;
29  /*int sc = */::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &res);
30  return (res.tv_sec*1e3 + res.tv_nsec*1e-6); // in milliseconds
31 #else
32  return -999.;
33 #endif
34  }
35 
36  struct Cpu {
37  Cpu() : user(0.), sys(0.), real(0.), rt_cpu(0.) {}
38  float user;
39  float sys;
40  float real;
41  float rt_cpu;
42  float cpu() const { return user + sys; }
43  };
44 
45  struct Mem {
46  Mem()
47  {
48  vmem[0] = vmem[1] = 0.;
49  rss[0] = rss[1] = 0.;
50  mall[0] = mall[1] = 0.;
51  nmall[0]= nmall[1]= 0.;
52  nfree[0]= nfree[1]= 0.;
53  }
54 
55  float vmem[2];
56  float rss[2];
57  float mall[2];
58  float nmall[2];
59  float nfree[2];
60  float dVmem() const { return vmem[1] - vmem[0]; }
61  float dRss() const { return rss [1] - rss [0]; }
62  float dMall() const { return mall[1] - mall[0]; }
63  float dNMall() const { return nmall[1] - nmall[0]; }
64  float dNFree() const { return nfree[1] - nfree[0]; }
65  };
66 
67  struct IoContainer {
68  Cpu r;
70  Cpu w;
71  };
72 
73  struct Component { //-> 12+32=44 bytes
76  };
77 
78  struct MallInfo {
79  static
80  inline float mallInfo()
81  {
82 #if !defined(__APPLE__)
84  return float(mi.uordblks+mi.hblkhd);
85 #else
86  return -999.;
87 #endif
88  }
89  };
90 
91 // struct MallInfo {
92 // int arena; /* non-mmapped space allocated from system */
93 // int ordblks; /* number of free chunks */
94 // int smblks; /* number of fastbin blocks */
95 // int hblks; /* number of mmapped regions */
96 // int hblkhd; /* space in mmapped regions */
97 // int usmblks; /* maximum total allocated space */
98 // int fsmblks; /* space available in freed fastbin blocks */
99 // int uordblks; /* total allocated space */
100 // int fordblks; /* total free space */
101 // int keepcost; /* top-most, releasable (via malloc_trim) space */
102 // };
103 
104 // MallInfo mallInfo();
105 // PerfMon::MallInfo PerfMon::mallInfo()
106 // {
107 // const MallInfo_t mi = ::mallinfo();
108 // MallInfo mo;
109 // mo.arena = mi.arena; /* non-mmapped space allocated from system */
110 // mo.ordblks = mi.ordblks; /* number of free chunks */
111 // mo.smblks = mi.smblks; /* number of fastbin blocks */
112 // mo.hblks = mi.hblks; /* number of mmapped regions */
113 // mo.hblkhd = mi.hblkhd; /* space in mmapped regions */
114 // mo.usmblks = mi.usmblks; /* maximum total allocated space */
115 // mo.fsmblks = mi.fsmblks; /* space available in freed fastbin blocks */
116 // mo.uordblks = mi.uordblks; /* total allocated space */
117 // mo.fordblks = mi.fordblks; /* total free space */
118 // mo.keepcost = mi.keepcost; /* top-most, releasable (via malloc_trim) space */
119 // return mo;
120 // }
121 
122 } // end namespace PerfMon
123 
124 #endif //> PERFMONEVENT_DATAMODEL_H
PerfMon::Cpu::sys
float sys
Definition: DataModel.h:39
PerfMon::Mem::dMall
float dMall() const
Definition: DataModel.h:62
PerfMon::Mem::dRss
float dRss() const
Definition: DataModel.h:61
PerfMon::Mem
Definition: DataModel.h:45
PerfMon::Mem::dNFree
float dNFree() const
Definition: DataModel.h:64
PerfMon::Cpu::user
float user
Definition: DataModel.h:38
PerfMon::Mem::dNMall
float dNMall() const
Definition: DataModel.h:63
PerfMon::mallinfo
mallinfo_t mallinfo()
Definition: mallinfo.h:29
PerfMon::Cpu::cpu
float cpu() const
Definition: DataModel.h:42
PerfMon::Mem::rss
float rss[2]
Definition: DataModel.h:56
PerfMon::IoContainer::r
Cpu r
Definition: DataModel.h:68
PerfMon
a simple malloc wrapper that keeps track of the amount of memory allocated on the heap.
Definition: CallGraphAuditor.cxx:24
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
PerfMon::Mem::mall
float mall[2]
Definition: DataModel.h:57
PerfMon::IoContainer::rr
Cpu rr
Definition: DataModel.h:69
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
PerfMon::mallinfo_t
struct mallinfo mallinfo_t
Definition: mallinfo.h:28
PerfMon::Mem::dVmem
float dVmem() const
Definition: DataModel.h:60
PerfMon::Component
Definition: DataModel.h:73
PerfMon::MallInfo::mallInfo
static float mallInfo()
Definition: DataModel.h:80
PerfMon::clock_gettime
struct timespec clock_gettime()
Definition: PerfMonEventDict.h:21
mallinfo.h
Wrappers for mallinfo.
PerfMon::rt_cpu
float rt_cpu()
Definition: DataModel.h:25
PerfMon::Cpu::real
float real
Definition: DataModel.h:40
PerfMon::Component::mem
Mem mem
Definition: DataModel.h:75
PerfMon::Cpu
Definition: DataModel.h:36
PerfMon::Cpu::rt_cpu
float rt_cpu
Definition: DataModel.h:41
PerfMon::Mem::nmall
float nmall[2]
Definition: DataModel.h:58
PerfMon::Mem::Mem
Mem()
Definition: DataModel.h:46
PerfMon::IoContainer
Definition: DataModel.h:67
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
PerfMon::Mem::nfree
float nfree[2]
Definition: DataModel.h:59
PerfMon::Mem::vmem
float vmem[2]
Definition: DataModel.h:55
PerfMon::IoContainer::w
Cpu w
Definition: DataModel.h:70
PerfMon::MallInfo
Definition: DataModel.h:78
PerfMon::Component::cpu
Cpu cpu
Definition: DataModel.h:74
readCCLHist.float
float
Definition: readCCLHist.py:83
PerfMon::Cpu::Cpu
Cpu()
Definition: DataModel.h:37