| The Gaudi Framework v28r2-patches (bc4ad17a)

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