| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

TimerForSequencer.h
Go to the documentation of this file.
1 #ifndef TIMERFORSEQUENCER_H
2
3 #include "GaudiKernel/MsgStream.h"
4 #include "GaudiKernel/Timing.h"
5 #include <inttypes.h>
6
20 class TimerForSequencer
21 {
22
23 public:
25 TimerForSequencer( std::string name, unsigned int size, double factor )
26 : m_name( std::move( name ) ), m_size( size ), m_factor( factor )
27 {
28 }
29
30 ~TimerForSequencer() = default;
31
33 inline void start()
34 {
35 m_startClock = System::currentTime( System::microSec );
36 m_startCpu = System::cpuTime( System::microSec );
37 }
38
42 uint64_t stop();
43
45 inline const std::string& name() const { return m_name; }
46
48 inline double lastTime() const { return m_lastTime * m_factor; }
49
51 inline double lastCpu() const { return m_lastCpu * m_factor; }
52
54 inline double elapsedTotal() const { return m_sum * m_factor; }
55
57 inline double cpuTotal() const { return m_sumCpu * m_factor; }
58
60 inline uint64_t count() const { return m_num; }
61
63 MsgStream& fillStream( MsgStream& s ) const;
64
66 static std::string header( std::string::size_type size );
67
68 private:
69 std::string m_name;
70 unsigned int m_size;
71 double m_factor;
72 uint64_t m_startClock = 0ULL;
73 uint64_t m_startCpu = 0ULL;
74
75 uint64_t m_num = 0ULL;
76 uint64_t m_lastTime = 0ULL;
77 uint64_t m_lastCpu = 0ULL;
78 uint64_t m_min = 0ULL;
79 uint64_t m_max = 0ULL;
80 uint64_t m_sum = 0ULL;
81 uint64_t m_sum2 = 0ULL;
82 uint64_t m_sumCpu = 0ULL;
83 };
84
85 inline MsgStream& operator<<( MsgStream& ms, const TimerForSequencer& count ) { return count.fillStream( ms ); }
86
87 #endif // TIMERFORSEQUENCER_H
TimerForSequencer::m_lastCpu
uint64_t m_lastCpu
Definition: TimerForSequencer.h:77
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
TimerForSequencer::fillStream
MsgStream & fillStream(MsgStream &s) const
Write measured time into the message stream.
Definition: TimerForSequencer.cpp:35
TimerForSequencer
Auxiliary class.
Definition: TimerForSequencer.h:20
TimerForSequencer::header
static std::string header(std::string::size_type size)
header matching the previous format
Definition: TimerForSequencer.cpp:61
MsgStream.h
TimerForSequencer::stop
uint64_t stop()
Stop time measurement and return the last elapsed time.
Definition: TimerForSequencer.cpp:10
std
STL namespace.
uint64_t
unsigned long long uint64_t
Definition: instrset.h:143
TimerForSequencer::lastCpu
double lastCpu() const
returns the last measured time
Definition: TimerForSequencer.h:51
TimerForSequencer::start
void start()
Start a time measurement.
Definition: TimerForSequencer.h:33
System::cpuTime
GAUDI_API longlong cpuTime(TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
Consumed CPU time of process in milliseconds.
Definition: Timing.cpp:196
TimerForSequencer::m_min
uint64_t m_min
Definition: TimerForSequencer.h:78
BrunelScenarioForwardScheduler.ms
ms
Definition: BrunelScenarioForwardScheduler.py:130
std::string
STL class.
TimerForSequencer::m_startClock
uint64_t m_startClock
Definition: TimerForSequencer.h:72
TimerForSequencer::TimerForSequencer
TimerForSequencer(std::string name, unsigned int size, double factor)
Constructor.
Definition: TimerForSequencer.h:25
TimerForSequencer::m_factor
double m_factor
Definition: TimerForSequencer.h:71
TimerForSequencer::m_size
unsigned int m_size
Definition: TimerForSequencer.h:70
System::microSec
Definition: Timing.h:58
operator<<
MsgStream & operator<<(MsgStream &ms, const TimerForSequencer &count)
Definition: TimerForSequencer.h:85
TimerForSequencer::lastTime
double lastTime() const
returns the last measured time
Definition: TimerForSequencer.h:48
System::currentTime
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:269
TimerForSequencer::m_sum
uint64_t m_sum
Definition: TimerForSequencer.h:80
TimerForSequencer::m_sum2
uint64_t m_sum2
Definition: TimerForSequencer.h:81
Timing.h
TimerForSequencer::m_startCpu
uint64_t m_startCpu
Definition: TimerForSequencer.h:73
TimerForSequencer::elapsedTotal
double elapsedTotal() const
returns the total elapsed time
Definition: TimerForSequencer.h:54
TimerForSequencer::m_max
uint64_t m_max
Definition: TimerForSequencer.h:79
TimerForSequencer::cpuTotal
double cpuTotal() const
returns the toptal cpu time
Definition: TimerForSequencer.h:57
TimerForSequencer::~TimerForSequencer
~TimerForSequencer()=default
TimerForSequencer::name
const std::string & name() const
returns the name
Definition: TimerForSequencer.h:45
gaudirun.s
string s
Definition: gaudirun.py:253
TimerForSequencer::m_lastTime
uint64_t m_lastTime
Definition: TimerForSequencer.h:76
TimerForSequencer::m_name
std::string m_name
Definition: TimerForSequencer.h:69
TimerForSequencer::m_num
uint64_t m_num
Definition: TimerForSequencer.h:75
TimerForSequencer::m_sumCpu
uint64_t m_sumCpu
Definition: TimerForSequencer.h:82
TimerForSequencer::count
uint64_t count() const
Returns the number run count.
Definition: TimerForSequencer.h:60