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 ()=default
 
 ~AthMonBench ()=default
 
void reset ()
 
bool isReset () const
 
void setUnitCount ()
 
void startMeasurement ()
 
void finishMeasurement ()
 
void operator-= (const AthMonBench &o)
 
void operator+= (const AthMonBench &o)
 
double deltaMem_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 ()
 

Private Attributes

TMem m_deltaMem {}
 
clock_t m_deltaCPU {}
 
int m_count {}
 

Detailed Description

Definition at line 25 of file AthMonBench.h.

Member Typedef Documentation

◆ TMem

typedef long long AthMonBench::TMem
private

Definition at line 52 of file AthMonBench.h.

Constructor & Destructor Documentation

◆ AthMonBench()

AthMonBench::AthMonBench ( )
default

◆ ~AthMonBench()

AthMonBench::~AthMonBench ( )
default

Member Function Documentation

◆ currentVMem()

AthMonBench::TMem AthMonBench::currentVMem ( )
staticprivate

Definition at line 22 of file AthMonBench.cxx.

22  {
23  long result = -1;
24  std::ifstream file("/proc/self/status");
25  const std::string search{"VmSize:"};
26  std::string line;
27  while(getline(file, line)) {
28  if (line.starts_with(search)) {
29  result = std::stol(line.substr(search.size()));
30  result = multiply<1024L>(result);
31  break;
32  }
33  }
34  return result;
35 }

◆ deltaCPU_ms()

double AthMonBench::deltaCPU_ms ( ) const
inline

Definition at line 109 of file AthMonBench.h.

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

◆ deltaMem_mb()

double AthMonBench::deltaMem_mb ( ) const
inline

Definition at line 108 of file AthMonBench.h.

108 { return valid()?m_deltaMem/(1024.0*1024.0*m_count): -99.99; }

◆ finishMeasurement()

void AthMonBench::finishMeasurement ( )
inline

Definition at line 83 of file AthMonBench.h.

83  {
85  m_deltaCPU = clock() - m_deltaCPU;
86  ++m_count;
87  if (m_count!=1) {
88  //Something is wrong:
89  reset();
90  m_count = -99999;
91  }
92 }

◆ isReset()

bool AthMonBench::isReset ( ) const
inline

Definition at line 71 of file AthMonBench.h.

71  {
72  return !(m_deltaMem||m_deltaCPU||m_count);
73 }

◆ operator+=()

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

Definition at line 101 of file AthMonBench.h.

101  {
102  m_deltaMem += o.m_deltaMem;
103  m_deltaCPU += o.m_deltaCPU;
104  m_count += o.m_count;
105 }

◆ operator-=()

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

Definition at line 95 of file AthMonBench.h.

95  {
98  m_count -= o.m_count;
99 }

◆ reset()

void AthMonBench::reset ( )
inline

Definition at line 65 of file AthMonBench.h.

65  {
66  m_deltaMem = 0;
67  m_deltaCPU = 0;
68  m_count = 0;
69 }

◆ setUnitCount()

void AthMonBench::setUnitCount ( )
inline

Definition at line 111 of file AthMonBench.h.

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

◆ startMeasurement()

void AthMonBench::startMeasurement ( )
inline

Definition at line 76 of file AthMonBench.h.

76  {
77  if (!isReset())
78  m_count = -99999;
80  m_deltaCPU = clock();
81 }

◆ valid()

bool AthMonBench::valid ( ) const
inline

Definition at line 110 of file AthMonBench.h.

110 { return m_count>0; }

Member Data Documentation

◆ m_count

int AthMonBench::m_count {}
private

Definition at line 55 of file AthMonBench.h.

◆ m_deltaCPU

clock_t AthMonBench::m_deltaCPU {}
private

Definition at line 54 of file AthMonBench.h.

◆ m_deltaMem

TMem AthMonBench::m_deltaMem {}
private

Definition at line 53 of file AthMonBench.h.

◆ s_resourceMonThreshold

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

Definition at line 28 of file AthMonBench.h.


The documentation for this class was generated from the following files:
AthMonBench::valid
bool valid() const
Definition: AthMonBench.h:110
checkFileSG.line
line
Definition: checkFileSG.py:75
get_generator_info.result
result
Definition: get_generator_info.py:21
AthMonBench::currentVMem
static TMem currentVMem()
Definition: AthMonBench.cxx:22
AthMonBench::m_deltaCPU
clock_t m_deltaCPU
Definition: AthMonBench.h:54
AthMonBench::m_count
int m_count
Definition: AthMonBench.h:55
search
void search(TDirectory *td, const std::string &s, std::string cwd, node *n)
recursive directory search for TH1 and TH2 and TProfiles
Definition: hcg.cxx:738
file
TFile * file
Definition: tile_monitor.h:29
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
AthMonBench::m_deltaMem
TMem m_deltaMem
Definition: AthMonBench.h:53
AthMonBench::isReset
bool isReset() const
Definition: AthMonBench.h:71
AthMonBench::reset
void reset()
Definition: AthMonBench.h:65