All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SequencerTimerTool.h
Go to the documentation of this file.
1 #ifndef SEQUENCERTIMERTOOL_H
2 #define SEQUENCERTIMERTOOL_H 1
3 
4 // Include files
5 // from Gaudi
6 #include "GaudiAlg/GaudiHistoTool.h"
7 #include "GaudiAlg/ISequencerTimerTool.h"
8 
9 // local
10 #include "TimerForSequencer.h"
11 
12 
27  virtual public ISequencerTimerTool
28 {
29 
30 public:
31 
35 
36 public:
37 
39  SequencerTimerTool( const std::string& type,
40  const std::string& name,
41  const IInterface* parent);
42 
43  ~SequencerTimerTool( ) override = default;
44 
46  StatusCode initialize() override;
47 
49  StatusCode finalize() override;
50 
52  int addTimer( const std::string& name ) override;
53 
55  void increaseIndent() override { m_indent += 1; }
56 
58  void decreaseIndent() override
59  {
60  m_indent = std::max( m_indent-1, 0 );
61  }
62 
64  void start( int index ) override { m_timerList[index].start(); }
65 
67  double stop( int index ) override { return m_timerList[index].stop(); }
68 
70  double lastTime( int index ) override { return m_timerList[index].lastTime(); }
71 
73  const std::string& name( int index ) override { return m_timerList[index].name(); }
74 
76  int indexByName( const std::string& name ) override;
77 
79  bool globalTiming() override { return m_globalTiming; };
80 
82  void saveHistograms() override;
83 
84 private:
85 
86  int m_shots = 3500000 ; // 1s on 2.8GHz Xeon, gcc 3.2, -o2; ///< Number of shots for CPU normalization
87  bool m_normalised;
88  int m_indent = 0;
89  std::vector<TimerForSequencer> m_timerList;
90  double m_normFactor = 0.001 ;
91  double m_speedRatio = 0;
93  std::string::size_type m_headerSize;
94 
95 };
96 #endif // SEQUENCERTIMERTOOL_H
StatusCode initialize() override
initialize method, to compute the normalization factor
void increaseIndent() override
Increase the indentation of the name.
void start(int index) override
start the counter, i.e.
~SequencerTimerTool() override=default
Destructor.
int indexByName(const std::string &name) override
returns the index of the counter with that name, or -1
void saveHistograms() override
prepares and saves the timing histograms
double stop(int index) override
stop the counter, return the elapsed time
std::string::size_type m_headerSize
Size of the name field.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of the basic interface.
Definition: IInterface.h:234
Simple class to extend the functionality of class GaudiTool.
virtual const std::string & name(int index)=0
returns the name of the counter
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
int addTimer(const std::string &name) override
add a timer entry with the specified name
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
int m_indent
Amount of indentation.
virtual void start(int index)=0
start the counter, i.e.
Implements the time measurement inside a sequencer.
Implements the time measurement inside a sequencer.
bool globalTiming() override
returns the flag telling that global timing is wanted
std::vector< TimerForSequencer > m_timerList
bool m_normalised
Is the time scaled to a nominal PIII ?
SequencerTimerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
void decreaseIndent() override
Decrease the indentation of the name.
virtual double stop(int index)=0
stop the counter, return the elapsed time
const std::string & name(int index) override
returns the name of the counter
StatusCode finalize() override
finalize method, to print the time summary table
double lastTime(int index) override
returns the last time
double m_normFactor
Factor to convert to standard CPU (1 GHz PIII)