42 template <
typename Clock,
typename Unit>
63 std::atomic_thread_fence( std::memory_order_relaxed );
64 auto dt = Clock::now() -
m_t0;
65 std::atomic_thread_fence( std::memory_order_relaxed );
66 return std::chrono::duration_cast<Unit>( dt );
74 typename Clock::time_point
m_t0;
81 template <
class OWNER>
83 o->declareCounter( name, std::string{
"timer:" } +
typeid( Unit::rep ).name(),
m_stats );
A scoped timer that starts/stops on con/de-struction.
Clock::time_point m_t0
start time of timer
Stats_t & m_stats
reference to statistics counter
void stop() const
Stop the timer, accumulate elapsed time and return current measurement.
ScopeTimer(Stats_t &stat)
Start Scoped timer accumulating into stat.
auto elapsed() const
Return the elapsed time without stopping the timer.
~ScopeTimer()
Destructor stopping timer.
const Stats_t & stats() const
Return accumulated timing statistics.
Gaudi::Accumulators::StatCounter< Unit > Stats_t
Type of Counter used for accumulating time measurements.
GenericTimer(OWNER *o, const std::string &name)
Constructor attaching the statistics counter to an owner.
Stats_t m_stats
statistics counter
GenericTimer(const GenericTimer &)=delete
No copy.
auto operator()() const
Create (and start) a ScopeTimer.
GenericTimer()=default
Default constructor.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
A counter aiming at computing average and sum2 / variance / standard deviation.