The Gaudi Framework  v33r0 (d5ea422b)
SequencerTimerTool.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef SEQUENCERTIMERTOOL_H
12 #define SEQUENCERTIMERTOOL_H 1
13 
14 // Include files
15 // from Gaudi
18 
19 // local
20 #include "TimerForSequencer.h"
21 
35 class SequencerTimerTool : public GaudiHistoTool, virtual public ISequencerTimerTool {
36 
37 public:
41 
42 public:
45 
47  StatusCode initialize() override;
48 
50  StatusCode finalize() override;
51 
53  int addTimer( const std::string& name ) override;
54 
56  void increaseIndent() override { m_indent += 1; }
57 
59  void decreaseIndent() override { m_indent = std::max( m_indent - 1, 0 ); }
60 
62  void start( int index ) override { m_timerList[index].start(); }
63 
65  double stop( int index ) override { return m_timerList[index].stop(); }
66 
68  double lastTime( int index ) override { return m_timerList[index].lastTime(); }
69 
71  const std::string& name( int index ) override { return m_timerList[index].name(); }
72 
74  int indexByName( const std::string& name ) override;
75 
77  bool globalTiming() override { return m_globalTiming; };
78 
80  void saveHistograms() override;
81 
82 private:
83  Gaudi::Property<int> m_shots{this, "Shots", 3500000, "number of shots for CPU normalization"};
84  Gaudi::Property<bool> m_normalised{this, "Normalised", false, "normalise the time to a nominal PIII"};
85  Gaudi::Property<bool> m_globalTiming{this, "GlobalTiming", false};
87  "number of characters to be used in algorithm name column"};
88 
89  int m_indent = 0;
91  double m_normFactor = 0.001;
92  double m_speedRatio = 0;
93 };
94 #endif // SEQUENCERTIMERTOOL_H
StatusCode initialize() override
initialize method, to compute the normalization factor
void increaseIndent() override
Increase the indentation of the name.
Implementation of property with value of concrete type.
Definition: Property.h:370
Gaudi::Property< bool > m_normalised
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
void start(int index) override
start the counter, i.e.
Header file for class : GaudiHistoTool.
int indexByName(const std::string &name) override
returns the index of the counter with that name, or -1
Simple class to extend the functionality of class GaudiTool.
STL class.
virtual const std::string & name() const =0
Retrieve the name of the instance.
Gaudi::Property< int > m_shots
void saveHistograms() override
prepares and saves the timing histograms
double stop(int index) override
stop the counter, return the elapsed time
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
Definition of the basic interface.
Definition: IInterface.h:254
virtual const std::string & type() const =0
The type of an AlgTool, meaning the concrete AlgTool class.
T max(T... args)
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 StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
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
SequencerTimerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Gaudi::Property< bool > m_globalTiming
void decreaseIndent() override
Decrease the indentation of the name.
Gaudi::Property< std::string::size_type > m_headerSize
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)