All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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:
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  {
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:
73  unsigned int m_size;
74  double m_factor;
77 
78  uint64_t m_num = 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;
86 
87 };
88 
90 {
91  return count.fillStream( ms );
92 }
93 
94 #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:144
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:167
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:245
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:245
uint64_t count() const
Returns the number run count.