FWCore
Utilities
interface
CPUTimer.h
Go to the documentation of this file.
1
#ifndef FWCore_Utilities_CPUTimer_h
2
#define FWCore_Utilities_CPUTimer_h
3
// -*- C++ -*-
4
//
5
// Package: Utilities
6
// Class : CPUTimer
7
//
16
//
17
// Original Author: Chris Jones
18
// Created: Sun Apr 16 20:32:13 EDT 2006
19
//
20
21
// system include files
22
#ifdef __linux__
23
//clock_gettime is not available on OS X
24
#define USE_CLOCK_GETTIME
25
#endif
26
27
#ifdef USE_CLOCK_GETTIME
28
#include <ctime>
29
#else
30
#include <sys/time.h>
31
#endif
32
33
// user include files
34
35
// forward declarations
36
namespace
edm
{
37
class
CPUTimer
{
38
public
:
39
CPUTimer
();
40
~CPUTimer
();
41
CPUTimer
(
CPUTimer
&&) =
default
;
42
CPUTimer
(
const
CPUTimer
&) =
delete
;
43
CPUTimer
&
operator=
(
const
CPUTimer
&) =
delete
;
44
45
struct
Times
{
46
Times
() :
real_
(0),
cpu_
(0) {}
47
double
real_
;
48
double
cpu_
;
49
};
50
51
// ---------- const member functions ---------------------
52
double
realTime
()
const
;
53
double
cpuTime
()
const
;
54
55
// ---------- static member functions --------------------
56
57
// ---------- member functions ---------------------------
58
void
start
();
59
Times
stop
();
//returns delta time
60
void
reset
();
61
62
void
add
(
const
Times
&
t
);
63
64
private
:
65
Times
calculateDeltaTime
()
const
;
66
67
// ---------- member data --------------------------------
68
enum
State
{
kRunning
,
kStopped
}
state_
;
69
#ifdef USE_CLOCK_GETTIME
70
struct
timespec
startRealTime_
;
71
struct
timespec
startCPUTime_
;
72
#else
73
struct
timeval
startRealTime_
;
74
struct
timeval
startCPUTime_
;
75
#endif
76
77
double
accumulatedRealTime_
;
78
double
accumulatedCPUTime_
;
79
};
80
}
// namespace edm
81
82
#endif
edm::CPUTimer::state_
enum edm::CPUTimer::State state_
edm::CPUTimer::Times::real_
double real_
Definition:
CPUTimer.h:47
edm::CPUTimer::State
State
Definition:
CPUTimer.h:68
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::CPUTimer
Definition:
CPUTimer.h:37
edm::CPUTimer::Times
Definition:
CPUTimer.h:45
edm::CPUTimer::start
void start()
Definition:
CPUTimer.cc:68
edm::CPUTimer::startCPUTime_
struct timeval startCPUTime_
Definition:
CPUTimer.h:74
edm::CPUTimer::reset
void reset()
Definition:
CPUTimer.cc:99
edm::CPUTimer::~CPUTimer
~CPUTimer()
Definition:
CPUTimer.cc:52
edm::CPUTimer::CPUTimer
CPUTimer()
Definition:
CPUTimer.cc:33
edm::CPUTimer::stop
Times stop()
Definition:
CPUTimer.cc:87
edm::CPUTimer::operator=
CPUTimer & operator=(const CPUTimer &)=delete
edm::CPUTimer::kRunning
Definition:
CPUTimer.h:68
edm::CPUTimer::cpuTime
double cpuTime() const
Definition:
CPUTimer.cc:146
edm::CPUTimer::accumulatedCPUTime_
double accumulatedCPUTime_
Definition:
CPUTimer.h:78
edm::CPUTimer::Times::cpu_
double cpu_
Definition:
CPUTimer.h:48
edm::CPUTimer::kStopped
Definition:
CPUTimer.h:68
edm::CPUTimer::realTime
double realTime() const
Definition:
CPUTimer.cc:139
edm::CPUTimer::startRealTime_
struct timeval startRealTime_
Definition:
CPUTimer.h:73
edm::CPUTimer::Times::Times
Times()
Definition:
CPUTimer.h:46
submitPVValidationJobs.t
string t
Definition:
submitPVValidationJobs.py:644
edm::CPUTimer::add
void add(const Times &t)
Definition:
CPUTimer.cc:104
edm::CPUTimer::accumulatedRealTime_
double accumulatedRealTime_
Definition:
CPUTimer.h:77
edm::CPUTimer::calculateDeltaTime
Times calculateDeltaTime() const
Definition:
CPUTimer.cc:109
Generated for CMSSW Reference Manual by
1.8.16