ATLAS Offline Software
Public Member Functions | Static Public Attributes | Private Types | Static Private Member Functions | Private Attributes | List of all members
AthMonBench Class Reference

#include <AthMonBench.h>

Collaboration diagram for AthMonBench:

Public Member Functions

 AthMonBench ()
 
 ~AthMonBench ()=default
 
void reset ()
 
bool isReset () const
 
void setUnitCount ()
 
void startMeasurement ()
 
void finishMeasurement ()
 
void operator-= (const AthMonBench &o)
 
void operator+= (const AthMonBench &o)
 
double deltaMemLW_mb () const
 
double deltaMemOther_mb () const
 
double deltaCPU_ms () const
 
bool valid () const
 

Static Public Attributes

static const MSG::Level s_resourceMonThreshold = MSG::DEBUG
 

Private Types

typedef long long TMem
 

Static Private Member Functions

static TMem currentVMem_ExcludingLWPools ()
 

Private Attributes

TMem m_deltaMemLW
 
TMem m_deltaMemOther
 
clock_t m_deltaCPU
 
int m_count
 

Detailed Description

Definition at line 27 of file AthMonBench.h.

Member Typedef Documentation

◆ TMem

typedef long long AthMonBench::TMem
private

Definition at line 55 of file AthMonBench.h.

Constructor & Destructor Documentation

◆ AthMonBench()

AthMonBench::AthMonBench ( )
inline

Definition at line 68 of file AthMonBench.h.

68 { reset(); }

◆ ~AthMonBench()

AthMonBench::~AthMonBench ( )
default

Member Function Documentation

◆ currentVMem_ExcludingLWPools()

AthMonBench::TMem AthMonBench::currentVMem_ExcludingLWPools ( )
staticprivate

Definition at line 9 of file AthMonBench.cxx.

10 {
11  long result = -1;
12  FILE* file = fopen("/proc/self/status", "r");
13  if (!file)
14  return result;
15  char line[128];
16  while (fgets(line, 128, file) != NULL){
17  if (strncmp(line, "VmSize:", 7) == 0) {
18  std::stringstream s(&(line[7]));
19  s >> result;
20  result *= 1024;//NB: ~1K uncertainty
22  break;
23  }
24  }
25  fclose(file);
26  return result;
27 }

◆ deltaCPU_ms()

double AthMonBench::deltaCPU_ms ( ) const
inline

Definition at line 121 of file AthMonBench.h.

121 { return valid()?m_deltaCPU*1.0e3/double(m_count*CLOCKS_PER_SEC) : -99.99; }

◆ deltaMemLW_mb()

double AthMonBench::deltaMemLW_mb ( ) const
inline

Definition at line 119 of file AthMonBench.h.

119 { return valid()?m_deltaMemLW/(1024.0*1024.0*m_count): -99.99; }

◆ deltaMemOther_mb()

double AthMonBench::deltaMemOther_mb ( ) const
inline

Definition at line 120 of file AthMonBench.h.

120 { return valid()?m_deltaMemOther/(1024.0*1024.0*m_count): -99.99; }

◆ finishMeasurement()

void AthMonBench::finishMeasurement ( )
inline

Definition at line 91 of file AthMonBench.h.

91  {
94  m_deltaCPU = clock() - m_deltaCPU;
95  ++m_count;
96  if (m_count!=1) {
97  //Something is wrong:
98  reset();
99  m_count = -99999;
100  }
101 }

◆ isReset()

bool AthMonBench::isReset ( ) const
inline

Definition at line 78 of file AthMonBench.h.

78  {
80 }

◆ operator+=()

void AthMonBench::operator+= ( const AthMonBench o)
inline

Definition at line 111 of file AthMonBench.h.

111  {
114  m_deltaCPU += o.m_deltaCPU;
115  m_count += o.m_count;
116 }

◆ operator-=()

void AthMonBench::operator-= ( const AthMonBench o)
inline

Definition at line 104 of file AthMonBench.h.

104  {
107  m_deltaCPU -= o.m_deltaCPU;
108  m_count -= o.m_count;
109 }

◆ reset()

void AthMonBench::reset ( )
inline

Definition at line 70 of file AthMonBench.h.

71 {
72  m_deltaMemLW = 0;
73  m_deltaMemOther = 0;
74  m_deltaCPU = 0;
75  m_count = 0;
76 }

◆ setUnitCount()

void AthMonBench::setUnitCount ( )
inline

Definition at line 123 of file AthMonBench.h.

123 { if (valid()) m_count=1; }

◆ startMeasurement()

void AthMonBench::startMeasurement ( )
inline

Definition at line 83 of file AthMonBench.h.

83  {
84  if (!isReset())
85  m_count = -99999;
88  m_deltaCPU = clock();
89 }

◆ valid()

bool AthMonBench::valid ( ) const
inline

Definition at line 122 of file AthMonBench.h.

122 { return m_count>0; }

Member Data Documentation

◆ m_count

int AthMonBench::m_count
private

Definition at line 59 of file AthMonBench.h.

◆ m_deltaCPU

clock_t AthMonBench::m_deltaCPU
private

Definition at line 58 of file AthMonBench.h.

◆ m_deltaMemLW

TMem AthMonBench::m_deltaMemLW
private

Definition at line 56 of file AthMonBench.h.

◆ m_deltaMemOther

TMem AthMonBench::m_deltaMemOther
private

Definition at line 57 of file AthMonBench.h.

◆ s_resourceMonThreshold

const MSG::Level AthMonBench::s_resourceMonThreshold = MSG::DEBUG
static

Definition at line 30 of file AthMonBench.h.


The documentation for this class was generated from the following files:
AthMonBench::valid
bool valid() const
Definition: AthMonBench.h:122
checkFileSG.line
line
Definition: checkFileSG.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
AthMonBench::m_deltaCPU
clock_t m_deltaCPU
Definition: AthMonBench.h:58
AthMonBench::m_count
int m_count
Definition: AthMonBench.h:59
AthMonBench::m_deltaMemOther
TMem m_deltaMemOther
Definition: AthMonBench.h:57
AthMonBench::m_deltaMemLW
TMem m_deltaMemLW
Definition: AthMonBench.h:56
LWHistStats::getTotalPoolMemUsed
static long long getTotalPoolMemUsed()
Definition: LWHistStats.cxx:27
file
TFile * file
Definition: tile_monitor.h:29
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
AthMonBench::isReset
bool isReset() const
Definition: AthMonBench.h:78
AthMonBench::currentVMem_ExcludingLWPools
static TMem currentVMem_ExcludingLWPools()
Definition: AthMonBench.cxx:9
AthMonBench::reset
void reset()
Definition: AthMonBench.h:70
LWHistStats::getTotalPoolMemAllocated
static long long getTotalPoolMemAllocated()
Definition: LWHistStats.cxx:21