The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Chrono.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 
14 #include <GaudiKernel/IChronoSvc.h>
15 #include <GaudiKernel/Kernel.h>
16 #include <string>
17 
28 public:
50  Chrono( IChronoSvc* svc = nullptr, // the service
51  const std::string& tag = "CHRONO::UNNAMED" ) // the unique tag/name
52  {
53  if ( svc ) { m_chrono = svc->chronoStart( tag ); }
54  }
55 
56  Chrono( Chrono&& rhs ) {
57  m_chrono = rhs.m_chrono;
58  rhs.m_chrono = nullptr;
59  }
60 
82  Chrono( const std::string& tag, // the unique tag/name
83  IChronoSvc* svc ) // the service
84  {
85  if ( svc ) { m_chrono = svc->chronoStart( tag ); }
86  }
87 
108  Chrono( ChronoEntity* c ) : m_chrono( c ) {
109  if ( m_chrono ) { m_chrono->start(); }
110  }
111 
132  Chrono( ChronoEntity& c ) : m_chrono( &c ) { m_chrono->start(); }
133 
136  if ( m_chrono ) { m_chrono->stop(); }
137  }
138 
139 private:
140  Chrono( const Chrono& ) = delete;
141  Chrono& operator=( const Chrono& ) = delete;
142 
144  ChronoEntity* m_chrono = nullptr; // The actual chronometer
145 };
Chrono::Chrono
Chrono(ChronoEntity *c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:108
Chrono::Chrono
Chrono(Chrono &&rhs)
Definition: Chrono.h:56
Chrono::operator=
Chrono & operator=(const Chrono &)=delete
ChronoEntity
Definition: ChronoEntity.h:26
Chrono::Chrono
Chrono(const Chrono &)=delete
gaudirun.c
c
Definition: gaudirun.py:525
Chrono::~Chrono
~Chrono()
Destructor , stop the chrono.
Definition: Chrono.h:135
Chrono::Chrono
Chrono(ChronoEntity &c)
Constructor from Chrono Object/Entity.
Definition: Chrono.h:132
Chrono
Definition: Chrono.h:27
IChronoSvc
Definition: IChronoSvc.h:31
ChronoEntity.h
Kernel.h
IChronoSvc::chronoStart
virtual ChronoEntity * chronoStart(const ChronoTag &t)=0
start chrono, tagged by its name
Chrono::Chrono
Chrono(const std::string &tag, IChronoSvc *svc)
Constructor from Chrono Service and the tag.
Definition: Chrono.h:82
IChronoSvc.h
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
Chrono::Chrono
Chrono(IChronoSvc *svc=nullptr, const std::string &tag="CHRONO::UNNAMED")
Constructor from Chrono Service and the tag.
Definition: Chrono.h:50