| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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,
26 unsigned int size,
27 double factor )
28 : m_name ( std::move(name) ),
29 m_size ( size ),
30 m_factor ( factor )
31 { }
32
33 ~TimerForSequencer() = default;
34
36 inline void start ()
37 {
38 m_startClock = System::currentTime( System::microSec );
39 m_startCpu = System::cpuTime ( System::microSec );
40 }
41
45 uint64_t stop();
46
48 inline const std::string& name() const { return m_name; }
49
51 inline double lastTime() const { return m_lastTime * m_factor; }
52
54 inline double lastCpu() const { return m_lastCpu * m_factor; }
55
57 inline double elapsedTotal() const { return m_sum * m_factor; }
58
60 inline double cpuTotal() const { return m_sumCpu * m_factor; }
61
63 inline uint64_t count() const { return m_num; }
64
66 MsgStream & fillStream(MsgStream & s) const;
67
69 static std::string header( std::string::size_type size );
70
71 private:
72 std::string m_name;
73 unsigned int m_size;
74 double m_factor;
75 uint64_t m_startClock = 0ULL;
76 uint64_t m_startCpu = 0ULL;
77
78 uint64_t m_num = 0ULL;
79 uint64_t m_lastTime = 0ULL;
80 uint64_t m_lastCpu = 0ULL;
81 uint64_t m_min = 0ULL;
82 uint64_t m_max = 0ULL;
83 uint64_t m_sum = 0ULL;
84 uint64_t m_sum2 = 0ULL;
85 uint64_t m_sumCpu = 0ULL;
86
87 };
88
89 inline MsgStream& operator<<(MsgStream& ms, const TimerForSequencer& count)
90 {
91 return count.fillStream( ms );
92 }
93
94 #endif // TIMERFORSEQUENCER_H
TimerForSequencer::m_lastCpu
uint64_t m_lastCpu
Definition: TimerForSequencer.h:80
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:34
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:63
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:144
TimerForSequencer::lastCpu
double lastCpu() const
returns the last measured time
Definition: TimerForSequencer.h:54
TimerForSequencer::start
void start()
Start a time measurement.
Definition: TimerForSequencer.h:36
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:167
TimerForSequencer::m_min
uint64_t m_min
Definition: TimerForSequencer.h:81
BrunelScenarioForwardScheduler.ms
ms
Definition: BrunelScenarioForwardScheduler.py:120
std::string
STL class.
TimerForSequencer::m_startClock
uint64_t m_startClock
Definition: TimerForSequencer.h:75
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:74
TimerForSequencer::m_size
unsigned int m_size
Definition: TimerForSequencer.h:73
System::microSec
Definition: Timing.h:57
operator<<
MsgStream & operator<<(MsgStream &ms, const TimerForSequencer &count)
Definition: TimerForSequencer.h:89
TimerForSequencer::lastTime
double lastTime() const
returns the last measured time
Definition: TimerForSequencer.h:51
System::currentTime
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:245
TimerForSequencer::m_sum
uint64_t m_sum
Definition: TimerForSequencer.h:83
TimerForSequencer::m_sum2
uint64_t m_sum2
Definition: TimerForSequencer.h:84
Timing.h
TimerForSequencer::m_startCpu
uint64_t m_startCpu
Definition: TimerForSequencer.h:76
TimerForSequencer::elapsedTotal
double elapsedTotal() const
returns the total elapsed time
Definition: TimerForSequencer.h:57
TimerForSequencer::m_max
uint64_t m_max
Definition: TimerForSequencer.h:82
TimerForSequencer::cpuTotal
double cpuTotal() const
returns the toptal cpu time
Definition: TimerForSequencer.h:60
TimerForSequencer::~TimerForSequencer
~TimerForSequencer()=default
TimerForSequencer::name
const std::string & name() const
returns the name
Definition: TimerForSequencer.h:48
gaudirun.s
string s
Definition: gaudirun.py:245
TimerForSequencer::m_lastTime
uint64_t m_lastTime
Definition: TimerForSequencer.h:79
TimerForSequencer::m_name
std::string m_name
Definition: TimerForSequencer.h:72
TimerForSequencer::m_num
uint64_t m_num
Definition: TimerForSequencer.h:78
TimerForSequencer::m_sumCpu
uint64_t m_sumCpu
Definition: TimerForSequencer.h:85
TimerForSequencer::count
uint64_t count() const
Returns the number run count.
Definition: TimerForSequencer.h:63