ATLAS Offline Software
CoWRecordStats.h
Go to the documentation of this file.
1 // --*- c++ -*--
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef COWTOOLS_RECORDSTATS
8 #define COWTOOLS_RECORDSTATS
9 #include <map>
10 #include <iostream>
11 
12 namespace CoWTools{
14  public:
16  enum ValueIdx{
17  Size=0,
18  Rss=1,
19  Pss=2,
27  Swap=10,
30  Locked=13,
31  VmFlags=14
32  };
33 
34 
36  for(int i=0;i<11;i++){
37  m_vals[i]+=rhs.m_vals[i];
38  }
39  m_vals[13]+=rhs.m_vals[13];
40  //needed only for very detailed
41  //m_vals[14]|=rhs.m_vals[14];
42  return *this;
43  }
44 
46  for(int i=0;i<11;i++){
47  m_vals[i]-=rhs.m_vals[i];
48  }
49  m_vals[13]-=rhs.m_vals[13];
50  //needed only for very detailed
51  //m_vals[14]|=rhs.m_vals[14];
52  return *this;
53  }
54 
55  inline CoWRecordStats operator-()const{
57  for(int i=0;i<11;i++){
58  m.m_vals[i]=-m_vals[i];
59  }
60  m.m_vals[11]=m_vals[11];
61  m.m_vals[12]=m_vals[12];
62  m.m_vals[13]=-m_vals[13];
63  m.m_vals[14]=m_vals[14];
64  //needed only for very detailed
65  //m_vals[14]|=rhs.m_vals[14];
66  return m;
67  }
68  friend CoWRecordStats operator+(const CoWRecordStats& lhs, const CoWRecordStats& rhs){
69  return CoWRecordStats(lhs) += rhs;
70  }
71  friend CoWRecordStats operator-(const CoWRecordStats& lhs, const CoWRecordStats& rhs){
72  return CoWRecordStats(lhs) -= rhs;
73  }
74  explicit operator bool() const {
75  for(int i=0;i<11;i++){
76  if(m_vals[i])return true;
77  }
78  return false;
79  }
80  friend bool operator<(const CoWRecordStats& a,const CoWRecordStats &b){
81  if((a.m_vals[5]+a.m_vals[6])<(b.m_vals[5]+b.m_vals[6])){
82  return true;
83  }else if((a.m_vals[5]+a.m_vals[6])==(b.m_vals[5]+b.m_vals[6])){
84  if((a.m_vals[3]+a.m_vals[4])<(b.m_vals[3]+b.m_vals[4])){
85  return true;
86  }else if((a.m_vals[3]+a.m_vals[4])==(b.m_vals[3]+b.m_vals[4])){
87  return (a.m_vals[1]<b.m_vals[1]);
88  }
89  return false;
90  }
91  return false;
92  }
93  void parseRecord(std::istream &in);
94  long long * getValueArray(){return m_vals;}
95  const long long * getValueArray() const {return m_vals;}
96  private:
97  long long m_vals[20]={0,0,0,0,0,
98  0,0,0,0,0,
99  0,0,0,0,0,
100  0,0,0,0,0};
101 
102  bool m_summary;
103  static const std::map<std::string,int> s_vmFlags;
104  friend std::ostream & operator<<(std::ostream &, const CoWTools::CoWRecordStats &m);
105  };
106 
107 }//end namespace
108 
109 #endif
110 
CoWTools::CoWRecordStats::getValueArray
long long * getValueArray()
Definition: CoWRecordStats.h:94
CoWTools::CoWRecordStats::operator+=
CoWRecordStats & operator+=(const CoWRecordStats &rhs)
Definition: CoWRecordStats.h:35
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
CoWTools::CoWRecordStats::operator-
friend CoWRecordStats operator-(const CoWRecordStats &lhs, const CoWRecordStats &rhs)
Definition: CoWRecordStats.h:71
CoWTools::CoWRecordStats::Rss
@ Rss
Definition: CoWRecordStats.h:18
CoWTools::CoWRecordStats::operator-
CoWRecordStats operator-() const
Definition: CoWRecordStats.h:55
CoWTools::CoWRecordStats::operator-=
CoWRecordStats & operator-=(const CoWRecordStats &rhs)
Definition: CoWRecordStats.h:45
CoWTools::CoWRecordStats::ValueIdx
ValueIdx
Definition: CoWRecordStats.h:16
CoWTools::CoWRecordStats::AnonHugePages
@ AnonHugePages
Definition: CoWRecordStats.h:26
CoWTools::CoWRecordStats::m_vals
long long m_vals[20]
Definition: CoWRecordStats.h:97
CoWTools::CoWRecordStats::operator<
friend bool operator<(const CoWRecordStats &a, const CoWRecordStats &b)
Definition: CoWRecordStats.h:80
CoWTools::CoWRecordStats::Size
@ Size
Definition: CoWRecordStats.h:17
CoWTools::CoWRecordStats::Shared_Dirty
@ Shared_Dirty
Definition: CoWRecordStats.h:21
CoWTools::CoWRecordStats::Private_Clean
@ Private_Clean
Definition: CoWRecordStats.h:22
CoWTools::CoWRecordStats::s_vmFlags
static const std::map< std::string, int > s_vmFlags
Definition: CoWRecordStats.h:103
lumiFormat.i
int i
Definition: lumiFormat.py:85
CoWTools::CoWRecordStats::VmFlags
@ VmFlags
Definition: CoWRecordStats.h:31
CoWTools::CoWRecordStats::Anonymous
@ Anonymous
Definition: CoWRecordStats.h:25
CoWTools::CoWRecordStats::Swap
@ Swap
Definition: CoWRecordStats.h:27
CoWTools::CoWRecordStats::operator<<
friend std::ostream & operator<<(std::ostream &, const CoWTools::CoWRecordStats &m)
Definition: CoWRecordStats.cxx:67
CoWTools::CoWRecordStats::m_summary
bool m_summary
Definition: CoWRecordStats.h:102
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CoWTools::CoWRecordStats::parseRecord
void parseRecord(std::istream &in)
Definition: CoWRecordStats.cxx:40
CoWTools::CoWRecordStats::Locked
@ Locked
Definition: CoWRecordStats.h:30
CoWTools::CoWRecordStats
Definition: CoWRecordStats.h:13
CoWTools
Definition: CoWLibrary.h:15
a
TList * a
Definition: liststreamerinfos.cxx:10
CoWTools::CoWRecordStats::CoWRecordStats
CoWRecordStats(bool summary=true)
Definition: CoWRecordStats.h:15
CoWTools::CoWRecordStats::Pss
@ Pss
Definition: CoWRecordStats.h:19
CoWTools::CoWRecordStats::KernelPageSize
@ KernelPageSize
Definition: CoWRecordStats.h:28
CoWTools::CoWRecordStats::Private_Dirty
@ Private_Dirty
Definition: CoWRecordStats.h:23
CoWTools::CoWRecordStats::getValueArray
const long long * getValueArray() const
Definition: CoWRecordStats.h:95
CoWTools::CoWRecordStats::MMUPageSize
@ MMUPageSize
Definition: CoWRecordStats.h:29
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
CoWTools::CoWRecordStats::Shared_Clean
@ Shared_Clean
Definition: CoWRecordStats.h:20
CoWTools::CoWRecordStats::operator+
friend CoWRecordStats operator+(const CoWRecordStats &lhs, const CoWRecordStats &rhs)
Definition: CoWRecordStats.h:68
CoWTools::CoWRecordStats::Referenced
@ Referenced
Definition: CoWRecordStats.h:24
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65