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 
14 {
15 
16 public:
17 
19  TimerForSequencer( std::string name,
20  unsigned int size,
21  double factor )
22  : m_name ( std::move(name) ),
23  m_size ( size ),
24  m_factor ( factor )
25  { }
26 
27  ~TimerForSequencer() = default;
28 
30  inline void start ()
31  {
34  }
35 
39  double stop();
40 
42  inline const std::string& name() const { return m_name; }
43 
45  inline double lastTime() const { return m_lastTime; }
46 
48  inline double lastCpu() const { return m_lastCpu; }
49 
51  inline double elapsedTotal() const { return m_sum; }
52 
54  inline double cpuTotal() const { return m_sumCpu; }
55 
57  inline double count() const { return m_num; }
58 
60  MsgStream & fillStream(MsgStream & s) const;
61 
63  static std::string header( std::string::size_type size );
64 
65 private:
66 
67  std::string m_name;
68  unsigned int m_size;
69  double m_factor;
70  long long m_startClock = 0LL ;
71  long long m_startCpu = 0LL ;
72 
73  long long m_num = 0LL;
74  double m_lastTime = 0.;
75  double m_lastCpu = 0.;
76  double m_min = 0.;
77  double m_max = 0.;
78  double m_sum = 0.;
79  double m_sumCpu = 0.;
80 };
81 
83 {
84  return count.fillStream( ms );
85 }
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.
Auxilliary class.
static std::string header(std::string::size_type size)
header matching the previous format
double count() const
Returns the number run count.
STL namespace.
double lastCpu() const
returns the last measured time
void start()
Start a time measurement.
TimerForSequencer(std::string name, unsigned int size, double factor)
Constructor.
double stop()
Stop time measurement and return the last elapsed time.
GAUDI_API longlong currentTime(TimeType typ=milliSec)
Retrieve absolute system time.
Definition: Timing.cpp:79
MsgStream & operator<<(MsgStream &ms, const TimerForSequencer &count)
double lastTime() const
returns the last measured time
double elapsedTotal() const
returns the total elapsed time
double cpuTotal() const
returns the total cpu time
~TimerForSequencer()=default
const std::string & name() const
returns the name
string s
Definition: gaudirun.py:246
GAUDI_API longlong cpuTime(TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
Consumed CPU time of process in milliseconds.
Definition: Timing.cpp:168
constexpr double ms