The Gaudi Framework
v32r2 (46d42edc)
Counters.h
Go to the documentation of this file.
1
#pragma once
2
3
#ifdef GAUDIKERNEL_COUNTERS_H
4
# error "GaudiKernel/Counters.h cannot be included before Gaudi/Chrono/Counters.h"
5
#endif
6
14
#include <chrono>
15
#include <cmath>
16
17
namespace
Gaudi
{
18
namespace
Accumulators {
19
/*
20
* std::chrono::duration only supports arithmetic operations that preserve the unit
21
* of time, e.g. there are no operations that would result in units of ms^2. This can
22
* be inconvenient for the use in general purpose libraries like Gaudi::Accumulators.
23
* This header provides the missing operators.
24
*/
25
27
template
<
class
Rep,
class
Period>
28
auto
sqrt
(
std::chrono::duration<Rep, Period>
d ) {
29
return
std::chrono::duration<Rep, Period>
( static_cast<Rep>(
std::round
(
std::sqrt
( d.
count
() ) ) ) );
30
}
31
33
template
<
class
Rep1,
class
Rep2,
class
Period>
34
auto
operator*
(
const
std::chrono::duration<Rep1, Period>
& lhs,
const
std::chrono::duration<Rep2, Period>
& rhs ) {
35
return
std::chrono::duration<std::common_type_t<Rep1, Rep2>
, Period>( lhs.
count
() * rhs.
count
() );
36
}
37
}
// namespace Accumulators
38
}
// namespace Gaudi
39
40
#include "
Gaudi/Chrono/ChronoIO.h
"
41
#include "
GaudiKernel/Counters.h
"
std::chrono::duration
ChronoIO.h
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:34
std::chrono::duration::count
T count(T... args)
Gaudi::Accumulators::sqrt
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Definition:
Counters.h:28
std::sqrt
T sqrt(T... args)
Counters.h
Gaudi
Header file for std:chrono::duration-based Counters.
Definition:
__init__.py:1
std::round
T round(T... args)
GaudiKernel
Gaudi
Chrono
Counters.h
Generated on Sat Sep 28 2019 18:06:49 for The Gaudi Framework by
1.8.15