Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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 
3 # include "GaudiKernel/MsgStream.h"
4 # include "GaudiKernel/Timing.h"
5 # include <inttypes.h>
6 
21 
22 public:
24  TimerForSequencer( std::string name, unsigned int size, double factor )
25  : m_name( std::move( name ) ), m_size( size ), m_factor( factor ) {}
26 
27  ~TimerForSequencer() = default;
28 
30  inline void start() {
33  }
34 
38  uint64_t stop();
39 
41  inline const std::string& name() const { return m_name; }
42 
44  inline double lastTime() const { return m_lastTime * m_factor; }
45 
47  inline double lastCpu() const { return m_lastCpu * m_factor; }
48 
50  inline double elapsedTotal() const { return m_sum * m_factor; }
51 
53  inline double cpuTotal() const { return m_sumCpu * m_factor; }
54 
56  inline uint64_t count() const { return m_num; }
57 
59  MsgStream& fillStream( MsgStream& s ) const;
60 
62  static std::string header( std::string::size_type size );
63 
64 private:
66  unsigned int m_size;
67  double m_factor;
70 
71  uint64_t m_num = 0ULL;
74  uint64_t m_min = 0ULL;
75  uint64_t m_max = 0ULL;
76  uint64_t m_sum = 0ULL;
77  uint64_t m_sum2 = 0ULL;
79 };
80 
81 inline MsgStream& operator<<( MsgStream& ms, const TimerForSequencer& count ) { return count.fillStream( ms ); }
82 
83 #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.
constexpr auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
STL class.
TimerForSequencer(std::string name, unsigned int size, double factor)
Constructor.
GAUDI_API long long currentTime()
Retrieve absolute system time.
Definition: Timing.h:250
MsgStream & operator<<(MsgStream &ms, const TimerForSequencer &count)
double lastTime() const
returns the last measured time
GAUDI_API long long cpuTime(TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
Consumed CPU time of process in milliseconds.
Definition: Timing.cpp:186
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:312
constexpr double ms
uint64_t count() const
Returns the number run count.