Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v38r0 (2143aa4c)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ISequencerTimerTool.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 ISEQUENCERTIMERTOOL_H
12 #define ISEQUENCERTIMERTOOL_H 1
13 
14 // from Gaudi
15 #include "GaudiKernel/IAlgTool.h"
16 
24 class GAUDI_API ISequencerTimerTool : public virtual IAlgTool {
25 
26 public:
27  using IAlgTool::name;
28  using IAlgTool::start;
29  using IAlgTool::stop;
30 
31 public:
34 
36  virtual int addTimer( const std::string& name ) = 0;
37 
39  virtual void increaseIndent() = 0;
40 
42  virtual void decreaseIndent() = 0;
43 
45  virtual void start( int index ) = 0;
46 
48  virtual double stop( int index ) = 0;
49 
51  virtual const std::string& name( int index ) = 0;
52 
54  virtual double lastTime( int index ) = 0;
55 
57  virtual int indexByName( const std::string& name ) = 0;
58 
60  virtual bool globalTiming() = 0;
61 
63  virtual void saveHistograms() = 0;
64 
72  [[nodiscard]] auto scopedTimer( int index, bool enable = true ) {
73  class Ret {
75  int index;
76 
77  public:
78  Ret( ISequencerTimerTool* tool, int index ) : tool{ tool }, index{ index } {
79  if ( tool ) tool->start( index );
80  }
81  ~Ret() { reset(); }
82  void reset() {
83  if ( tool ) tool->stop( index );
84  }
85  };
86  return Ret{ enable ? this : nullptr, index };
87  }
88 };
89 
90 #endif // ISEQUENCERTIMERTOOL_H
std::string
STL class.
IAlgTool
Definition: IAlgTool.h:33
bug_34121.name
name
Definition: bug_34121.py:20
ISequencerTimerTool::globalTiming
virtual bool globalTiming()=0
returns the flag telling that global timing is wanted
ISequencerTimerTool::indexByName
virtual int indexByName(const std::string &name)=0
returns the index of the counter with that name, or -1
IAlgTool::start
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
ISequencerTimerTool::increaseIndent
virtual void increaseIndent()=0
Increase the indentation of the name.
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
ISequencerTimerTool::decreaseIndent
virtual void decreaseIndent()=0
Decrease the indentation of the name.
ISequencerTimerTool
Definition: ISequencerTimerTool.h:24
ISequencerTimerTool::scopedTimer
auto scopedTimer(int index, bool enable=true)
Start timer by index. The timer stops on destruction of returned object.
Definition: ISequencerTimerTool.h:72
bug_34121.tool
tool
Definition: bug_34121.py:17
Gaudi::Monitoring::reset
void reset(T &)
default (empty) implementation of reset method for types stored into an entity
Definition: MonitoringHub.h:75
ISequencerTimerTool::saveHistograms
virtual void saveHistograms()=0
prepares and saves the timing histograms
IAlgTool.h
ISequencerTimerTool::start
virtual void start(int index)=0
start the counter, i.e.
IAlgTool::stop
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
ISequencerTimerTool::name
virtual const std::string & name(int index)=0
returns the name of the counter
ISequencerTimerTool::lastTime
virtual double lastTime(int index)=0
returns the last measured time time
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
ISequencerTimerTool::stop
virtual double stop(int index)=0
stop the counter, return the elapsed time
Gaudi::ParticleProperties::index
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Definition: IParticlePropertySvc.cpp:39
ISequencerTimerTool::DeclareInterfaceID
DeclareInterfaceID(ISequencerTimerTool, 3, 0)
InterfaceID.
ISequencerTimerTool::addTimer
virtual int addTimer(const std::string &name)=0
add a timer entry with the specified name