The Gaudi Framework
master (6507eef1)
Toggle main menu visibility
Loading...
Searching...
No Matches
Counters.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
20
#include <chrono>
21
#include <cmath>
22
23
namespace
Gaudi
{
24
namespace
Accumulators
{
25
/*
26
* std::chrono::duration only supports arithmetic operations that preserve the unit
27
* of time, e.g. there are no operations that would result in units of ms^2. This can
28
* be inconvenient for the use in general purpose libraries like Gaudi::Accumulators.
29
* This header provides the missing operators.
30
*/
31
33
template
<
class
Rep,
class
Period>
34
auto
sqrt
( std::chrono::duration<Rep, Period> d ) {
35
return
std::chrono::duration<Rep, Period>(
static_cast<
Rep
>
( std::round( std::sqrt( d.count() ) ) ) );
36
}
37
39
template
<
class
Rep1,
class
Rep2,
class
Period>
40
auto
operator*
(
const
std::chrono::duration<Rep1, Period>& lhs,
const
std::chrono::duration<Rep2, Period>& rhs ) {
41
return
std::chrono::duration<std::common_type_t<Rep1, Rep2>, Period>( lhs.count() * rhs.count() );
42
}
43
}
// namespace Accumulators
44
}
// namespace Gaudi
45
46
#include <
Gaudi/Accumulators.h
>
Accumulators.h
Gaudi::Accumulators
Efficient counter implementations for Gaudi.
Definition
Accumulators.h:18
Gaudi::Accumulators::operator*
auto operator*(const std::chrono::duration< Rep1, Period > &lhs, const std::chrono::duration< Rep2, Period > &rhs)
Multiplication of two std::chrono::duration objects with same Period.
Definition
Counters.h:40
Gaudi::Accumulators::sqrt
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Definition
Counters.h:34
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
GaudiKernel
include
Gaudi
Chrono
Counters.h
Generated on
for The Gaudi Framework by
1.17.0