The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
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
15#include <GaudiKernel/Kernel.h>
16#include <string>
17
28public:
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
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
139private:
140 Chrono( const Chrono& ) = delete;
141 Chrono& operator=( const Chrono& ) = delete;
142
144 ChronoEntity* m_chrono = nullptr; // The actual chronometer
145};
#define GAUDI_API
Definition Kernel.h:49
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Chrono(ChronoEntity *c)
Constructor from Chrono Object/Entity.
Definition Chrono.h:108
Chrono(const Chrono &)=delete
ChronoEntity * m_chrono
The actual chronometer.
Definition Chrono.h:144
Chrono(Chrono &&rhs)
Definition Chrono.h:56
Chrono & operator=(const Chrono &)=delete
~Chrono()
Destructor , stop the chrono.
Definition Chrono.h:135
Chrono(const std::string &tag, IChronoSvc *svc)
Constructor from Chrono Service and the tag.
Definition Chrono.h:82
Chrono(ChronoEntity &c)
Constructor from Chrono Object/Entity.
Definition Chrono.h:132
Chrono(IChronoSvc *svc=nullptr, const std::string &tag="CHRONO::UNNAMED")
Constructor from Chrono Service and the tag.
Definition Chrono.h:50
"Chrono"-related part of interface IChronoStatSvc
Definition IChronoSvc.h:31
virtual ChronoEntity * chronoStart(const ChronoTag &t)=0
start chrono, tagged by its name