The Gaudi Framework  v30r3 (a5ef0a68)
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 {
27 public:
28  // =========================================================================
50  Chrono( IChronoSvc* svc = nullptr, // the service
51  const std::string& tag = "CHRONO::UNNAMED" ) // the unique tag/name
52  {
53  if ( svc ) {
54  m_chrono = svc->chronoStart( tag );
55  }
56  }
57 
58  // =========================================================================
62  Chrono( Chrono&& rhs )
63  {
64  m_chrono = rhs.m_chrono;
65  rhs.m_chrono = nullptr;
66  }
67 
68  // =========================================================================
90  Chrono( const std::string& tag, // the unique tag/name
91  IChronoSvc* svc ) // the service
92  {
93  if ( svc ) {
94  m_chrono = svc->chronoStart( tag );
95  }
96  }
97  // =========================================================================
118  Chrono( ChronoEntity* c ) : m_chrono( c )
119  {
120  if ( m_chrono ) {
121  m_chrono->start();
122  }
123  }
124  // =========================================================================
145  Chrono( ChronoEntity& c ) : m_chrono( &c ) { m_chrono->start(); }
146  // =========================================================================
149  {
150  if ( m_chrono ) {
151  m_chrono->stop();
152  }
153  }
154  // =========================================================================
155 private:
156  // =========================================================================
158  Chrono( const Chrono& ) = delete;
159  Chrono& operator=( const Chrono& ) = delete;
160  // =========================================================================
161 private:
162  // ==========================================================================
164  ChronoEntity* m_chrono = nullptr; // The actual chronometer
165  // ==========================================================================
166 };
167 // ============================================================================
168 // The END
169 // ============================================================================
170 #endif // GAUDIKERNEL_CHRONO_H
171 // ============================================================================
virtual ChronoEntity * chronoStart(const ChronoTag &t)=0
start chrono, tagged by its name
~Chrono()
Destructor , stop the chrono.
Definition: Chrono.h:148
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:62
A small utility class for chronometry of user codes.
Definition: Chrono.h:25
Chrono(ChronoEntity *c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:118
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
Chrono(const std::string &tag, IChronoSvc *svc)
Constructor from Chrono Service and the tag.
Definition: Chrono.h:90
Chrono(ChronoEntity &c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:145
Chrono(IChronoSvc *svc=nullptr, const std::string &tag="CHRONO::UNNAMED")
Constructor from Chrono Service and the tag.
Definition: Chrono.h:50
#define GAUDI_API
Definition: Kernel.h:104
"Chrono"-related part of interface IChronoStatSvc
Definition: IChronoSvc.h:31