Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Chrono.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_CHRONO_H
2 #define GAUDIKERNEL_CHRONO_H
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD& STL
7 // ============================================================================
8 #include <string>
9 // ============================================================================
10 // GaudiKernel
11 // ============================================================================
13 #include "GaudiKernel/IChronoSvc.h"
14 #include "GaudiKernel/Kernel.h"
15 // ============================================================================
26 public:
27  // =========================================================================
49  Chrono( IChronoSvc* svc = nullptr, // the service
50  const std::string& tag = "CHRONO::UNNAMED" ) // the unique tag/name
51  {
52  if ( svc ) { m_chrono = svc->chronoStart( tag ); }
53  }
54 
55  // =========================================================================
59  Chrono( Chrono&& rhs ) {
60  m_chrono = rhs.m_chrono;
61  rhs.m_chrono = nullptr;
62  }
63 
64  // =========================================================================
86  Chrono( const std::string& tag, // the unique tag/name
87  IChronoSvc* svc ) // the service
88  {
89  if ( svc ) { m_chrono = svc->chronoStart( tag ); }
90  }
91  // =========================================================================
112  Chrono( ChronoEntity* c ) : m_chrono( c ) {
113  if ( m_chrono ) { m_chrono->start(); }
114  }
115  // =========================================================================
136  Chrono( ChronoEntity& c ) : m_chrono( &c ) { m_chrono->start(); }
137  // =========================================================================
140  if ( m_chrono ) { m_chrono->stop(); }
141  }
142  // =========================================================================
143 private:
144  // =========================================================================
146  Chrono( const Chrono& ) = delete;
147  Chrono& operator=( const Chrono& ) = delete;
148  // =========================================================================
149 private:
150  // ==========================================================================
152  ChronoEntity* m_chrono = nullptr; // The actual chronometer
153  // ==========================================================================
154 };
155 // ============================================================================
156 // The END
157 // ============================================================================
158 #endif // GAUDIKERNEL_CHRONO_H
virtual ChronoEntity * chronoStart(const ChronoTag &t)=0
start chrono, tagged by its name
~Chrono()
Destructor , stop the chrono.
Definition: Chrono.h:139
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
Chrono(Chrono &&rhs)
Move Constructor.
Definition: Chrono.h:59
A small utility class for chronometry of user codes.
Definition: Chrono.h:25
Chrono(ChronoEntity *c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:112
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
Chrono(const std::string &tag, IChronoSvc *svc)
Constructor from Chrono Service and the tag.
Definition: Chrono.h:86
Chrono(ChronoEntity &c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:136
Chrono(IChronoSvc *svc=nullptr, const std::string &tag="CHRONO::UNNAMED")
Constructor from Chrono Service and the tag.
Definition: Chrono.h:49
#define GAUDI_API
Definition: Kernel.h:71
"Chrono"-related part of interface IChronoStatSvc
Definition: IChronoSvc.h:31