ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PMonUtils::CustomBenchmark Class Reference

#include <CustomBenchmark.h>

Collaboration diagram for PMonUtils::CustomBenchmark:

Classes

struct  Data
 

Public Member Functions

 CustomBenchmark (unsigned nmax)
 
 ~CustomBenchmark ()
 
void begin (unsigned id)
 
void end (int count)
 
void getData (unsigned id, uint64_t &count, double &time_ms) const
 
unsigned nMax () const
 
unsigned size () const
 

Private Member Functions

 CustomBenchmark (const CustomBenchmark &)
 
CustomBenchmarkoperator= (const CustomBenchmark &)
 

Static Private Member Functions

static int64_t clock_nooverflow ()
 

Private Attributes

const unsigned m_nmax
 
Datam_data
 
Datam_data_current
 

Detailed Description

Definition at line 30 of file CustomBenchmark.h.

Constructor & Destructor Documentation

◆ CustomBenchmark() [1/2]

PMonUtils::CustomBenchmark::CustomBenchmark ( unsigned  nmax)

Definition at line 9 of file CustomBenchmark.cxx.

10  : m_nmax(nmax),
11  m_data(new Data[nmax]),
13  {
14  Data * itE = &(m_data[m_nmax]);
15  for (Data * it = m_data; it!=itE; ++it)
16  it->init();
17  }

◆ ~CustomBenchmark()

PMonUtils::CustomBenchmark::~CustomBenchmark ( )

Definition at line 19 of file CustomBenchmark.cxx.

20  {
21  delete[] m_data;
22  }

◆ CustomBenchmark() [2/2]

PMonUtils::CustomBenchmark::CustomBenchmark ( const CustomBenchmark )
private

Member Function Documentation

◆ begin()

void PMonUtils::CustomBenchmark::begin ( unsigned  id)
inline

Definition at line 67 of file CustomBenchmark.h.

68  {
69  assert(id<m_nmax);
70  m_data_current = &(m_data[id]);
72  }

◆ clock_nooverflow()

int64_t PMonUtils::CustomBenchmark::clock_nooverflow ( )
inlinestaticprivate

Definition at line 89 of file CustomBenchmark.h.

89  {
90  //Copied from PerfMonComps/trunk/src/SemiDetMisc.h
91  //
92  //In gnu, clock_t is a long and CLOCKS_PER_SECOND 1000000 so clock()
93  //will overflow in 32bit builds after a few thousands of seconds. To
94  //avoid this, we have the following method instead which notices when
95  //overflow occurs and corrects for it (it won't notice if it doesn't
96  //get called for >4000s, but this should be ok for almost all of our
97  //use cases):
98  assert(std::numeric_limits<clock_t>::is_integer);
99  if (sizeof(clock_t)>=sizeof(int64_t))
100  return clock();//64bit builds shouldn't have overflow issues.
101 
102  //not so clean with statics i guess:
103  static clock_t last=clock();
104  static int64_t offset=0;
105  clock_t c=clock();
106  if (c<last)
108  last=c;
109  return offset+c;
110  }

◆ end()

void PMonUtils::CustomBenchmark::end ( int  count = 1)
inline

Definition at line 73 of file CustomBenchmark.h.

◆ getData()

void PMonUtils::CustomBenchmark::getData ( unsigned  id,
uint64_t &  count,
double &  time_ms 
) const
inline

Definition at line 81 of file CustomBenchmark.h.

82  {
83  assert(id<m_nmax);
84  Data * data = &(m_data[id]);
85  count = data->count;
86  time_ms = data->time_spent * (1000.0/CLOCKS_PER_SEC);
87  }

◆ nMax()

unsigned PMonUtils::CustomBenchmark::nMax ( ) const
inline

Definition at line 42 of file CustomBenchmark.h.

42 { return m_nmax; }

◆ operator=()

CustomBenchmark& PMonUtils::CustomBenchmark::operator= ( const CustomBenchmark )
private

◆ size()

unsigned PMonUtils::CustomBenchmark::size ( ) const
inline

Definition at line 43 of file CustomBenchmark.h.

43 { return m_nmax; }

Member Data Documentation

◆ m_data

Data* PMonUtils::CustomBenchmark::m_data
private

Definition at line 55 of file CustomBenchmark.h.

◆ m_data_current

Data* PMonUtils::CustomBenchmark::m_data_current
private

Definition at line 56 of file CustomBenchmark.h.

◆ m_nmax

const unsigned PMonUtils::CustomBenchmark::m_nmax
private

Definition at line 54 of file CustomBenchmark.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
max
#define max(a, b)
Definition: cfImp.cxx:41
Data
@ Data
Definition: BaseObject.h:11
PMonUtils::CustomBenchmark::clock_nooverflow
static int64_t clock_nooverflow()
Definition: CustomBenchmark.h:89
PMonUtils::CustomBenchmark::m_nmax
const unsigned m_nmax
Definition: CustomBenchmark.h:54
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PMonUtils::CustomBenchmark::Data::time_spent
int64_t time_spent
Definition: CustomBenchmark.h:49
PMonUtils::CustomBenchmark::m_data_current
Data * m_data_current
Definition: CustomBenchmark.h:56
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
TruthTest.itE
itE
Definition: TruthTest.py:25
PMonUtils::CustomBenchmark::Data::time_at_begin
int64_t time_at_begin
Definition: CustomBenchmark.h:50
PMonUtils::CustomBenchmark::Data::count
unsigned count
Definition: CustomBenchmark.h:51
PMonUtils::CustomBenchmark::m_data
Data * m_data
Definition: CustomBenchmark.h:55
min
#define min(a, b)
Definition: cfImp.cxx:40
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
python.compressB64.c
def c
Definition: compressB64.py:93
nmax
const int nmax(200)