TimerForSequencer.h
Go to the documentation of this file.
1 // $Id: TimerForSequencer.h,v 1.5 2004/11/25 13:26:26 mato Exp $
2 #ifndef TIMERFORSEQUENCER_H
3 
4 #include "GaudiKernel/MsgStream.h"
5 #include "GaudiKernel/Timing.h"
6 
15 {
16 
17 public:
18 
20  TimerForSequencer( const std::string& name,
21  const unsigned int size,
22  const double factor )
23  : m_name ( name ),
24  m_size ( size ),
25  m_factor ( factor ),
26  m_startClock ( 0LL ),
27  m_startCpu ( 0LL ),
28  m_num ( 0LL ),
29  m_lastTime ( 0. ),
30  m_lastCpu ( 0. ),
31  m_min ( 0. ),
32  m_max ( 0. ),
33  m_sum ( 0. ),
34  m_sumCpu ( 0. )
35  { }
36 
38 
40  inline void start ()
41  {
44  }
45 
49  double stop();
50 
52  inline const std::string& name() const { return m_name; }
53 
55  inline double lastTime() const { return m_lastTime; }
56 
58  inline double lastCpu() const { return m_lastCpu; }
59 
61  inline double elapsedTotal() const { return m_sum; }
62 
64  inline double cpuTotal() const { return m_sumCpu; }
65 
67  inline double count() const { return (double)m_num; }
68 
70  MsgStream & fillStream(MsgStream & s) const;
71 
73  static std::string header( std::string::size_type size );
74 
75 private:
76 
77  std::string m_name;
78  unsigned int m_size;
79  double m_factor;
80  long long m_startClock;
81  long long m_startCpu;
82 
83  long long m_num;
84  double m_lastTime;
85  double m_lastCpu;
86  double m_min;
87  double m_max;
88  double m_sum;
89  double m_sumCpu;
90 };
91 
93 {
94  return count.fillStream( ms );
95 }
96 
97 #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.
double lastCpu() const
returns the last measured time
void start()
Start a time measurement.
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:80
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
const std::string & name() const
returns the name
string s
Definition: gaudirun.py:244
GAUDI_API longlong cpuTime(TimeType typ=milliSec, InfoType fetch=Times, long pid=-1)
Consumed CPU time of process in milliseconds.
Definition: Timing.cpp:169
constexpr double ms
TimerForSequencer(const std::string &name, const unsigned int size, const double factor)
Constructor.