The Gaudi Framework  v29r0 (ff2e7097)
TimerForSequencer.h
Go to the documentation of this file.
1 #ifndef TIMERFORSEQUENCER_H
2 
4 #include "GaudiKernel/Timing.h"
5 #include <inttypes.h>
6 
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  {
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:
70  unsigned int m_size;
71  double m_factor;
74 
75  uint64_t m_num = 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;
83 };
84 
85 inline MsgStream& operator<<( MsgStream& ms, const TimerForSequencer& count ) { return count.fillStream( ms ); }
86 
87 #endif // TIMERFORSEQUENCER_H
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & fillStream(MsgStream &s) const
Write measured time into the message stream.
Auxiliary class.
static std::string header(std::string::size_type size)
header matching the previous format
uint64_t stop()
Stop time measurement and return the last elapsed time.
STL namespace.
unsigned long long uint64_t
Definition: instrset.h:143
double lastCpu() const
returns the last measured time
void start()
Start a time measurement.
GAUDI_API longlong cpuTime(TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
Consumed CPU time of process in milliseconds.
Definition: Timing.cpp:196
STL class.
TimerForSequencer(std::string name, unsigned int size, double factor)
Constructor.
MsgStream & operator<<(MsgStream &ms, const TimerForSequencer &count)
double lastTime() const
returns the last measured time
GAUDI_API longlong currentTime()
Retrieve absolute system time.
Definition: Timing.h:269
double elapsedTotal() const
returns the total elapsed time
double cpuTotal() const
returns the toptal cpu time
~TimerForSequencer()=default
const std::string & name() const
returns the name
string s
Definition: gaudirun.py:253
uint64_t count() const
Returns the number run count.