| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
26 class SequencerTimerTool : public GaudiHistoTool,
27 virtual public ISequencerTimerTool
28 {
29
30 public:
31
32 using ISequencerTimerTool::start;
33 using ISequencerTimerTool::stop;
34 using ISequencerTimerTool::name;
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;
92 bool m_globalTiming;
93 std::string::size_type m_headerSize;
94
95 };
96 #endif // SEQUENCERTIMERTOOL_H
SequencerTimerTool::initialize
StatusCode initialize() override
initialize method, to compute the normalization factor
Definition: SequencerTimerTool.cpp:44
SequencerTimerTool::increaseIndent
void increaseIndent() override
Increase the indentation of the name.
Definition: SequencerTimerTool.h:55
IAlgTool::start
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
SequencerTimerTool::start
void start(int index) override
start the counter, i.e.
Definition: SequencerTimerTool.h:64
GaudiHistoTool.h
Header file for class : GaudiHistoTool.
SequencerTimerTool::m_shots
int m_shots
Definition: SequencerTimerTool.h:86
SequencerTimerTool::~SequencerTimerTool
~SequencerTimerTool() override=default
Destructor.
SequencerTimerTool::indexByName
int indexByName(const std::string &name) override
returns the index of the counter with that name, or -1
Definition: SequencerTimerTool.cpp:98
std::string
STL class.
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
SequencerTimerTool::saveHistograms
void saveHistograms() override
prepares and saves the timing histograms
Definition: SequencerTimerTool.cpp:115
SequencerTimerTool::stop
double stop(int index) override
stop the counter, return the elapsed time
Definition: SequencerTimerTool.h:67
SequencerTimerTool::m_headerSize
std::string::size_type m_headerSize
Size of the name field.
Definition: SequencerTimerTool.h:93
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
GaudiHistoTool
Simple class to extend the functionality of class GaudiTool.
Definition: GaudiHistoTool.h:42
TimerForSequencer.h
IAlgTool::type
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
std::max
T max(T...args)
SequencerTimerTool::addTimer
int addTimer(const std::string &name) override
add a timer entry with the specified name
Definition: SequencerTimerTool.cpp:138
IAlgTool::parent
virtual const IInterface * parent() const =0
The parent of the concrete AlgTool.
SequencerTimerTool::m_indent
int m_indent
Amount of indentation.
Definition: SequencerTimerTool.h:88
std::vector< TimerForSequencer >
IAlgTool::stop
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
SequencerTimerTool
Implements the time measurement inside a sequencer.
Definition: SequencerTimerTool.h:26
ISequencerTimerTool
Implements the time measurement inside a sequencer.
Definition: ISequencerTimerTool.h:14
ISequencerTimerTool.h
SequencerTimerTool::globalTiming
bool globalTiming() override
returns the flag telling that global timing is wanted
Definition: SequencerTimerTool.h:79
SequencerTimerTool::m_timerList
std::vector< TimerForSequencer > m_timerList
Definition: SequencerTimerTool.h:89
SequencerTimerTool::m_normalised
bool m_normalised
Is the time scaled to a nominal PIII ?
Definition: SequencerTimerTool.h:87
SequencerTimerTool::SequencerTimerTool
SequencerTimerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: SequencerTimerTool.cpp:26
SequencerTimerTool::decreaseIndent
void decreaseIndent() override
Decrease the indentation of the name.
Definition: SequencerTimerTool.h:58
SequencerTimerTool::m_speedRatio
double m_speedRatio
Definition: SequencerTimerTool.h:91
SequencerTimerTool::name
const std::string & name(int index) override
returns the name of the counter
Definition: SequencerTimerTool.h:73
SequencerTimerTool::finalize
StatusCode finalize() override
finalize method, to print the time summary table
Definition: SequencerTimerTool.cpp:71
SequencerTimerTool::lastTime
double lastTime(int index) override
returns the last time
Definition: SequencerTimerTool.h:70
SequencerTimerTool::m_normFactor
double m_normFactor
Factor to convert to standard CPU (1 GHz PIII)
Definition: SequencerTimerTool.h:90
SequencerTimerTool::m_globalTiming
bool m_globalTiming
Definition: SequencerTimerTool.h:92