![]() |
The Gaudi Framework
v31r0 (aeb156f0)
|
Efficient counter implementations for Gaudi. More...
Classes | |
class | AccumulatorSet |
AccumulatorSet is an Accumulator that holds a set of Accumulators templated by same Arithmetic and Atomicity and increase them altogether. More... | |
struct | Adder |
An Adder ValueHandler operator(a, b) means a += b. More... | |
struct | Adder< Arithmetic, atomicity::full > |
Adder specialization in the case of atomicity full. More... | |
struct | Adder< Arithmetic, atomicity::none > |
Adder specialization in the case of atomicity none. More... | |
struct | AveragingAccumulator |
AveragingAccumulator. More... | |
struct | AveragingCounter |
A counter aiming at computing sum and average. More... | |
struct | BaseValueHandler |
Base type for all functors used as ValuesHandler. More... | |
struct | BaseValueHandler< Arithmetic, atomicity::full > |
BaseValueHandler specialization in the case of atomicity full. More... | |
struct | BaseValueHandler< Arithmetic, atomicity::none > |
BaseValueHandler specialization in the case of atomicity none. More... | |
struct | BinomialAccumulator |
BinomialAccumulator. More... | |
struct | BinomialCounter |
A counter dealing with binomial data. More... | |
class | Buffer |
Buffer is a non atomic Accumulator which, when it goes out-of-scope, updates the underlying thread-safe Accumulator for all previous updates in one go. More... | |
struct | BufferableCounter |
An empty ancester of all counters that provides a buffer method that returns a buffer on itself. More... | |
struct | Constant |
An functor always returning the value N. More... | |
struct | CountAccumulator |
CountAccumulator. More... | |
struct | Counter |
A basic counter counting input values. More... | |
struct | Extremum |
An Extremum ValueHandler, to be reused for Minimum and Maximum operator(a, b) means if (Compare(b,a)) a = b In case of full atomicity, compare_exchange_weak is used. More... | |
struct | Extremum< Arithmetic, atomicity::full, Compare, Initial > |
Extremum specialization in the case of atomicity full. More... | |
struct | Extremum< Arithmetic, atomicity::none, Compare, Initial > |
Extremum specialization in the case of atomicity none. More... | |
struct | FalseAccumulator |
FalseAccumulator. More... | |
struct | FalseTo1 |
helper functor for the FalseAccumulator More... | |
class | GenericAccumulator |
Generic Accumulator, templated by. More... | |
struct | Identity |
An Identity functor. More... | |
struct | MaxAccumulator |
MaxAccumulator. More... | |
struct | MinAccumulator |
MinAccumulator. More... | |
struct | PrintableCounter |
An empty ancester of all counters that knows how to print themselves. More... | |
struct | SigmaAccumulator |
SigmaAccumulator. More... | |
struct | SigmaCounter |
A counter aiming at computing average and sum2 / variance / standard deviation. More... | |
struct | Square |
A Square functor. More... | |
struct | SquareAccumulator |
SquareAccumulator. More... | |
struct | StatCounter |
A counter aiming at computing average and sum2 / variance / standard deviation. More... | |
struct | SumAccumulator |
SumAccumulator. More... | |
struct | TrueAccumulator |
TrueAccumulator. More... | |
struct | TrueTo1 |
helper functor for the TrueAccumulator More... | |
Typedefs | |
template<typename T , typename = int> | |
using | has_fetch_add_ = decltype(std::atomic< T >{}.fetch_add(0)) |
type_traits for checking the presence of fetch_add in std::atomic<T> More... | |
template<typename T > | |
using | has_fetch_add = typename Gaudi::cpp17::is_detected< has_fetch_add_, T >::value_t |
template<typename Arithmetic , typename Result = double> | |
using | fp_result_type = std::conditional_t< std::is_integral< Arithmetic >::value, Result, Arithmetic > |
type_trait for the result type of a floating point operation on the type Arithmetic More... | |
template<typename Arithmetic , atomicity Atomicity = atomicity::full> | |
using | Minimum = Extremum< Arithmetic, Atomicity, std::less< Arithmetic >, std::numeric_limits< Arithmetic >::max > |
A Minimun ValueHandler operator(a, b) means a = min(a, b) In case of full atomicity, compare_exchange_weak is used. More... | |
template<typename Arithmetic , atomicity Atomicity = atomicity::full> | |
using | Maximum = Extremum< Arithmetic, Atomicity, std::greater< Arithmetic >, std::numeric_limits< Arithmetic >::lowest > |
An Maximum ValueHandler operator(a, b) means a = max(a, b) In case of full atomicity, compare_exchange_weak is used. More... | |
template<typename Arithmetic , atomicity Atomicity = atomicity::full> | |
using | StatAccumulator = AccumulatorSet< Arithmetic, Atomicity, SigmaAccumulator, MinAccumulator, MaxAccumulator > |
StatAccumulator. More... | |
template<typename Arithmetic = double, atomicity Atomicity = atomicity::full> | |
using | SummingCounter = AveragingCounter< Arithmetic, Atomicity > |
Enumerations | |
enum | atomicity { atomicity::none, atomicity::full } |
Defines atomicity of the accumulators. More... | |
Functions | |
std::ostream & | operator<< (std::ostream &s, const PrintableCounter &counter) |
external printout operator to a stream type More... | |
MsgStream & | operator<< (MsgStream &s, const PrintableCounter &counter) |
template<typename Counter , typename Container , typename Fun > | |
void | accumulate (Counter &counter, const Container &container, Fun f=Identity{}) |
A helper function for accumulating data from a container into a counter This is internally using buffers so that the original counter is only updated once. More... | |
Efficient counter implementations for Gaudi.
A number of concepts and templated classes are defined:
All Accumulators and Counters defined above are provided in their atomic and non atomic versions
Here is an example of the typical usage of these classes :
using Gaudi::Accumulators::fp_result_type = typedef std::conditional_t<std::is_integral<Arithmetic>::value, Result, Arithmetic> |
type_trait for the result type of a floating point operation on the type Arithmetic
Definition at line 194 of file Counters.h.
using Gaudi::Accumulators::has_fetch_add = typedef typename Gaudi::cpp17::is_detected<has_fetch_add_, T>::value_t |
Definition at line 188 of file Counters.h.
using Gaudi::Accumulators::has_fetch_add_ = typedef decltype( std::atomic<T>{}.fetch_add( 0 ) ) |
type_traits for checking the presence of fetch_add in std::atomic<T>
Definition at line 186 of file Counters.h.
using Gaudi::Accumulators::Maximum = typedef Extremum<Arithmetic, Atomicity, std::greater<Arithmetic>, std::numeric_limits<Arithmetic>::lowest> |
An Maximum ValueHandler operator(a, b) means a = max(a, b) In case of full atomicity, compare_exchange_weak is used.
Definition at line 333 of file Counters.h.
using Gaudi::Accumulators::Minimum = typedef Extremum<Arithmetic, Atomicity, std::less<Arithmetic>, std::numeric_limits<Arithmetic>::max> |
A Minimun ValueHandler operator(a, b) means a = min(a, b) In case of full atomicity, compare_exchange_weak is used.
Definition at line 326 of file Counters.h.
using Gaudi::Accumulators::StatAccumulator = typedef AccumulatorSet<Arithmetic, Atomicity, SigmaAccumulator, MinAccumulator, MaxAccumulator> |
StatAccumulator.
A StatAccumulator is an Accumulator able to compute an average, variance/rms and min/max
Definition at line 589 of file Counters.h.
using Gaudi::Accumulators::SummingCounter = typedef AveragingCounter<Arithmetic, Atomicity> |
Definition at line 729 of file Counters.h.
|
strong |
Defines atomicity of the accumulators.
Enumerator | |
---|---|
none | |
full |
Definition at line 149 of file Counters.h.
void Gaudi::Accumulators::accumulate | ( | Counter & | counter, |
const Container & | container, | ||
Fun | f = Identity{} |
||
) |
A helper function for accumulating data from a container into a counter This is internally using buffers so that the original counter is only updated once.
Definition at line 824 of file Counters.h.
|
inline |
|
inline |
Definition at line 654 of file Counters.h.