| The Gaudi Framework v32r1 (f65d50dc)

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
25 class SequencerTimerTool : public GaudiHistoTool, virtual public ISequencerTimerTool {
26
27 public:
28 using ISequencerTimerTool::name;
29 using ISequencerTimerTool::start;
30 using ISequencerTimerTool::stop;
31
32 public:
34 SequencerTimerTool( const std::string& type, const std::string& name, const IInterface* parent );
35
37 StatusCode initialize() override;
38
40 StatusCode finalize() override;
41
43 int addTimer( const std::string& name ) override;
44
46 void increaseIndent() override { m_indent += 1; }
47
49 void decreaseIndent() override { m_indent = std::max( m_indent - 1, 0 ); }
50
52 void start( int index ) override { m_timerList[index].start(); }
53
55 double stop( int index ) override { return m_timerList[index].stop(); }
56
58 double lastTime( int index ) override { return m_timerList[index].lastTime(); }
59
61 const std::string& name( int index ) override { return m_timerList[index].name(); }
62
64 int indexByName( const std::string& name ) override;
65
67 bool globalTiming() override { return m_globalTiming; };
68
70 void saveHistograms() override;
71
72 private:
73 Gaudi::Property<int> m_shots{this, "Shots", 3500000, "number of shots for CPU normalization"};
74 Gaudi::Property<bool> m_normalised{this, "Normalised", false, "normalise the time to a nominal PIII"};
75 Gaudi::Property<bool> m_globalTiming{this, "GlobalTiming", false};
76 Gaudi::Property<std::string::size_type> m_headerSize{this, "NameSize", 30,
77 "number of characters to be used in algorithm name column"};
78
79 int m_indent = 0;
80 std::vector<TimerForSequencer> m_timerList;
81 double m_normFactor = 0.001;
82 double m_speedRatio = 0;
83 };
84 #endif // SEQUENCERTIMERTOOL_H
SequencerTimerTool::initialize
StatusCode initialize() override
initialize method, to compute the normalization factor
Definition: SequencerTimerTool.cpp:36
SequencerTimerTool::increaseIndent
void increaseIndent() override
Increase the indentation of the name.
Definition: SequencerTimerTool.h:46
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
SequencerTimerTool::m_normalised
Gaudi::Property< bool > m_normalised
Definition: SequencerTimerTool.h:74
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:52
GaudiHistoTool.h
Header file for class : GaudiHistoTool.
SequencerTimerTool::indexByName
int indexByName(const std::string &name) override
returns the index of the counter with that name, or -1
Definition: SequencerTimerTool.cpp:83
GaudiHistoTool
Simple class to extend the functionality of class GaudiTool.
Definition: GaudiHistoTool.h:39
std::string
STL class.
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
SequencerTimerTool::m_shots
Gaudi::Property< int > m_shots
Definition: SequencerTimerTool.h:73
SequencerTimerTool::saveHistograms
void saveHistograms() override
prepares and saves the timing histograms
Definition: SequencerTimerTool.cpp:98
SequencerTimerTool::stop
double stop(int index) override
stop the counter, return the elapsed time
Definition: SequencerTimerTool.h:55
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IInterface
Definition of the basic interface.
Definition: IInterface.h:244
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:119
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:79
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:25
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:67
SequencerTimerTool::m_timerList
std::vector< TimerForSequencer > m_timerList
Definition: SequencerTimerTool.h:80
SequencerTimerTool::SequencerTimerTool
SequencerTimerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: SequencerTimerTool.cpp:26
SequencerTimerTool::m_globalTiming
Gaudi::Property< bool > m_globalTiming
Definition: SequencerTimerTool.h:75
SequencerTimerTool::decreaseIndent
void decreaseIndent() override
Decrease the indentation of the name.
Definition: SequencerTimerTool.h:49
SequencerTimerTool::m_headerSize
Gaudi::Property< std::string::size_type > m_headerSize
Definition: SequencerTimerTool.h:76
SequencerTimerTool::m_speedRatio
double m_speedRatio
Definition: SequencerTimerTool.h:82
SequencerTimerTool::name
const std::string & name(int index) override
returns the name of the counter
Definition: SequencerTimerTool.h:61
SequencerTimerTool::finalize
StatusCode finalize() override
finalize method, to print the time summary table
Definition: SequencerTimerTool.cpp:61
SequencerTimerTool::lastTime
double lastTime(int index) override
returns the last time
Definition: SequencerTimerTool.h:58
SequencerTimerTool::m_normFactor
double m_normFactor
Factor to convert to standard CPU (1 GHz PIII)
Definition: SequencerTimerTool.h:81