Go to the documentation of this file.
19 template <
class Rep,
class Period>
21 template <
class Rep1,
class Rep2,
class Period>
26 #if defined( __GNUC__ ) && ( __GNUC__ == 11 ) && !defined( __clang__ ) && __cplusplus >= 202002L
28 template <
typename Ratio>
29 static constexpr
const char* suffix(
const Ratio& ) {
32 }
else if constexpr ( std::ratio_equal_v<Ratio, std::milli> ) {
34 }
else if constexpr ( std::ratio_equal_v<Ratio, std::micro> ) {
36 }
else if constexpr ( std::ratio_equal_v<Ratio, std::nano> ) {
38 }
else if constexpr ( std::ratio_equal_v<Ratio,
std::ratio<60>> ) {
45 template <
class Rep,
class Period>
47 return os << d.
count() << suffix( Period{} );
235 #include <boost/format.hpp>
239 #include <nlohmann/json.hpp>
242 #include <type_traits>
251 template <
class Rep,
class Period>
252 struct adl_serializer<
std::chrono::duration<Rep, Period>> {
272 template <
typename T, T N>
274 template <
typename U>
284 template <
typename U>
285 constexpr decltype(
auto ) operator()( U&&
v )
const noexcept {
286 return std::forward<U>(
v );
294 template <
typename U>
295 constexpr decltype(
auto ) operator()( U&&
v )
const noexcept {
303 template <
typename T,
typename =
int>
305 template <
typename T>
306 inline constexpr
bool has_fetch_add_v = Gaudi::cpp17::is_detected_v<has_fetch_add_, T>;
311 template <
typename Arithmetic,
typename Result =
double>
312 using fp_result_type = std::conditional_t<std::is_integral_v<Arithmetic>, Result, Arithmetic>;
317 template <
typename Arithmetic, atomicity Atomicity>
323 template <
typename Arithmetic>
334 template <
typename Arithmetic>
339 return v.load( std::memory_order_relaxed );
348 template <
typename Arithmetic, atomicity Atomicity>
354 template <
typename Arithmetic>
365 template <
typename AtomicType,
typename Arithmetic>
367 if constexpr ( has_fetch_add_v<AtomicType> ) {
368 atVar.fetch_add( value, std::memory_order_relaxed );
371 while ( !atVar.compare_exchange_weak( current, current + value ) )
379 template <
typename Arithmetic>
385 if constexpr ( !std::is_floating_point_v<Arithmetic> ) {
386 if ( DefaultValue() == b )
return;
396 template <
typename Arithmetic, atomicity Atomicity,
typename Compare, Arithmetic ( *Initial )()>
402 template <
typename Arithmetic,
typename Compare, Arithmetic ( *Initial )()>
408 if ( Compare{}( b, a ) ) a = b;
415 template <
typename Arithmetic,
typename Compare, Arithmetic ( *Initial )()>
422 while ( Compare{}( b, prev_value ) && !a.compare_exchange_weak( prev_value, b ) )
431 template <
typename Arithmetic, atomicity Atomicity = atomicity::full>
438 template <
typename Arithmetic, atomicity Atomicity = atomicity::full>
469 typename InputTransform = Identity,
typename OutputTransform = Identity,
470 typename ValueHandler = Adder<InnerType, Atomicity>>
472 template <
typename,
typename, atomicity,
typename,
typename,
typename>
477 #if __cplusplus >= 201703L
478 using OutputType = std::decay_t<std::invoke_result_t<OutputTransform, InnerType>>;
480 using OutputType = std::decay_t<std::result_of_t<OutputTransform( InnerType )>>;
490 template <atomicity ato,
typename VH>
494 template <
typename... Args>
503 template <atomicity ato,
typename VH>
507 template <atomicity ato,
typename VH>
517 return j.at( entries ).get<InnerType>();
521 typename ValueHandler::InternalType
m_value{ ValueHandler::DefaultValue() };
529 template <
typename Arithmetic,
atomicity Atomicity,
typename InputTypeT = Arithmetic,
530 template <atomicity,
typename>
class... Bases>
539 template <atomicity ato>
543 ( Bases<Atomicity, Arithmetic>::operator+=( by ), ... );
547 void reset() { ( Bases<Atomicity, Arithmetic>::reset(), ... ); }
548 template <atomicity Ato>
550 ( Bases<Atomicity, Arithmetic>::mergeAndReset(
static_cast<Bases<Ato, Arithmetic>&
>( other ) ), ... );
552 template <atomicity Ato>
560 std::apply( [
this](
const auto&... i ) { ( this->Bases<Atomicity, Arithmetic>::reset( i ), ... ); },
t );
567 template <
size_t... Is>
569 std::index_sequence<Is...> ) {
574 typename Bases<Atomicity, Arithmetic>::JSONStringEntriesType... entries ) {
575 return { Bases<Atomicity, Arithmetic>::extractJSONData(
j, entries )... };
583 template <atomicity Atomicity,
typename Arithmetic =
double>
585 :
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Maximum<Arithmetic, Atomicity>> {
595 template <atomicity Atomicity,
typename Arithmetic =
double>
597 :
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Minimum<Arithmetic, Atomicity>> {
609 template <atomicity Atomicity,
typename Arithmetic =
double>
613 ( *this ) += Arithmetic{};
628 template <atomicity Atomicity,
typename Arithmetic =
double>
639 template <atomicity Atomicity,
typename Arithmetic =
unsigned long>
641 static_assert( std::is_integral_v<Arithmetic>,
642 "Invalid Arithmetic type for IntegralAccumulator. It must be an integral type" );
662 template <atomicity Atomicity,
typename Arithmetic =
double>
678 template <atomicity Atomicity,
typename Arithmetic>
694 template <atomicity Atomicity,
typename Arithmetic>
705 template <atomicity Atomicity,
typename Arithmetic>
710 template <
typename Result = fp_result_type<Arithmetic>>
713 if ( 1 > nbEntries )
return Result{ -1 };
714 return static_cast<Result
>( this->
nTrueEntries() ) / nbEntries;
718 template <
typename Result = fp_result_type<Arithmetic>>
725 if ( 1 > nbEntries )
return Result{ -1 };
726 return sqrt(
static_cast<Result
>( this->
nTrueEntries() * this->nFalseEntries() ) / nbEntries ) / nbEntries;
735 assert( b.nPass <= b.nTotal );
749 template <atomicity Atomicity,
typename Arithmetic,
template <atomicity,
typename>
typename CountAcc,
750 template <atomicity,
typename>
typename SumAcc>
752 :
AccumulatorSet<Arithmetic, Atomicity, typename CountAcc<Atomicity, Arithmetic>::InputType, CountAcc, SumAcc> {
753 static_assert( std::is_same_v<
typename CountAcc<Atomicity, Arithmetic>::InputType,
754 typename SumAcc<Atomicity, Arithmetic>::InputType>,
755 "Incompatible Counters in definition of AveragingAccumulator. Both should have identical Input" );
758 template <
typename Result = fp_result_type<Arithmetic>>
760 auto n = this->nEntries();
761 Result sum = this->sum();
762 return (
n > 0 ) ?
static_cast<Result
>( sum /
n ) : Result{};
770 template <atomicity Atomicity,
typename Arithmetic>
778 template <atomicity Atomicity,
typename Arithmetic,
template <atomicity,
typename>
typename AvgAcc,
779 template <atomicity,
typename>
typename SquareAcc>
781 :
AccumulatorSet<Arithmetic, Atomicity, typename AvgAcc<Atomicity, Arithmetic>::InputType, AvgAcc, SquareAcc> {
782 static_assert( std::is_same_v<
typename AvgAcc<Atomicity, Arithmetic>::InputType,
783 typename SquareAcc<Atomicity, Arithmetic>::InputType>,
784 "Incompatible Counters in definition of SigmaAccumulator. Both should have identical Input" );
787 template <
typename Result = fp_result_type<Arithmetic>>
789 auto n = this->nEntries();
790 Result sum = this->sum();
791 return (
n > 0 ) ?
static_cast<Result
>( ( this->sum2() - sum * ( sum /
n ) ) /
n ) : Result{};
794 template <
typename Result = fp_result_type<Arithmetic>>
796 auto n = this->nEntries();
797 Result sum = this->sum();
798 return (
n > 1 ) ?
static_cast<Result
>( ( this->sum2() - sum * ( sum /
n ) ) / (
n - 1 ) ) : Result{};
801 template <
typename Result = fp_result_type<Arithmetic>>
808 return ( Result{ 0 } >
v ) ? Result{} :
static_cast<Result
>(
sqrt(
v ) );
810 [[deprecated(
"The name 'rms' has changed to standard_deviation" )]] Arithmetic
rms()
const {
814 template <
typename Result = fp_result_type<Arithmetic>>
816 auto n = this->nEntries();
817 if ( 0 ==
n )
return Result{};
823 return ( Result{ 0 } >
v ) ? Result{} :
static_cast<Result
>(
sqrt(
v /
n ) );
831 template <atomicity Atomicity,
typename Arithmetic>
838 template <atomicity Atomicity,
typename Arithmetic>
848 template <
template <
atomicity Ato,
typename...
Int>
class ContainedAccumulator,
atomicity Atomicity, typename... Args>
849 class Buffer :
public ContainedAccumulator<atomicity::none, Args...> {
860 if ( m_prime ) { m_prime->mergeAndReset(
static_cast<base_type&
>( *
this ) ); }
877 template <
typename stream>
910 template <
atomicity Atomicity,
template <
atomicity Ato,
typename...
Int>
class Accumulator, typename... Args>
913 using Accumulator<Atomicity, Args...>::Accumulator;
916 template <
typename OWNER>
922 if ( m_monitoringHub ) { m_monitoringHub->removeEntity( *
this ); }
928 template <
typename OWNER,
typename SELF,
typename... CARGS>
930 : Accumulator<Atomicity, Args...>(
args... ), m_monitoringHub( &o->serviceLocator()->monitoringHub() ) {
931 m_monitoringHub->registerEntity( o->name(),
name,
self.typeString,
self );
942 template <atomicity Atomicity = atomicity::full,
typename Arithmetic =
unsigned long>
946 template <
typename OWNER>
956 template <
typename stream>
959 auto fmt = ( tableFormat ?
"|%|10d| |" :
"#=%|-7lu|" );
971 j = { {
"type",
c.typeString }, {
"empty",
c.nEntries() == 0 }, {
"nEntries",
c.nEntries() } };
982 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
985 typeid( Arithmetic ).
name() };
987 template <
typename OWNER>
992 template <
typename stream>
994 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |" :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g|" );
1007 j = { {
"type",
c.typeString },
1008 {
"empty",
c.nEntries() == 0 },
1009 {
"nEntries",
c.nEntries() },
1011 {
"mean",
c.mean() } };
1017 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1024 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1028 template <
typename OWNER>
1033 template <
typename stream>
1035 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |"
1036 :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g|" );
1048 j = { {
"type",
c.typeString },
1049 {
"empty",
c.nEntries() == 0 },
1050 {
"nEntries",
c.nEntries() },
1052 {
"mean",
c.mean() },
1053 {
"sum2",
c.sum2() },
1054 {
"standard_deviation",
c.standard_deviation() } };
1065 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1069 template <
typename OWNER>
1074 template <
typename stream>
1076 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |"
1077 :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" );
1078 return o <<
boost::format{
fmt } % this->nEntries() % this->sum() % this->mean() % this->standard_deviation() %
1079 this->min() % this->max();
1090 j = { {
"type",
c.typeString },
1091 {
"empty",
c.nEntries() == 0 },
1092 {
"nEntries",
c.nEntries() },
1094 {
"mean",
c.mean() },
1095 {
"sum2",
c.sum2() },
1096 {
"standard_deviation",
c.standard_deviation() },
1098 {
"max",
c.max() } };
1102 j, { { {
"nEntries",
"sum" },
"sum2" },
"min",
"max" } );
1110 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1113 typeid( Arithmetic ).
name() };
1115 template <
typename OWNER>
1119 template <
typename stream>
1121 auto fmt = ( tableFormat ?
"|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%% |"
1122 :
"#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|" );
1132 template <
typename stream>
1136 return print( o,
true );
1145 j = { {
"type",
c.typeString },
1146 {
"empty",
c.nEntries() == 0 },
1147 {
"nEntries",
c.nTrueEntries() +
c.nFalseEntries() },
1148 {
"nTrueEntries",
c.nTrueEntries() },
1149 {
"nFalseEntries",
c.nFalseEntries() },
1150 {
"efficiency",
c.efficiency() },
1151 {
"efficiencyErr",
c.efficiencyErr() } };
1158 namespace details::MsgCounter {
1159 template <atomicity Atomicity>
1162 static void merge(
typename Base::InternalType& orig,
bool b ) {
1168 template <atomicity Atomicity,
typename Arithmetic =
double>
1172 template <MSG::Level level, atomicity Atomicity = atomicity::full>
1176 template <
typename OWNER>
1181 template <
typename OWNER>
1197 template <
typename stream>
1199 return o <<
boost::format{ tableFormat ?
"|%|10d| |" :
"#=%|-7lu|" } % this->
value();
1208 j = { {
"type",
c.typeString }, {
"empty",
c.value() == 0 },
1209 {
"nEntries",
c.value() }, {
"level",
level },
1210 {
"max",
c.max }, {
"msg",
c.msg } };
1213 return {
j.at(
"msg" ).get<
std::string>(),
j.at(
"max" ).get<
unsigned long>(),
1214 j.at(
"nEntries" ).get<
unsigned long>() };
1227 if ( this->
value() == max ) {
1241 template <
typename Counter,
typename Container,
typename Fun>
1244 for (
const auto& elem : container ) b += f( elem );
MsgCounter(std::string const &ms, unsigned long nMax, unsigned long count)
An empty ancester of all counters that knows how to print themselves.
stream & printImpl(stream &s, std::string_view tag) const
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
unsigned long InternalType
static const std::string typeString
static InternalType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
const CommonMessagingBase * logger
friend void mergeAndReset(MsgCounter &c, MsgCounter &o)
stream & printImpl(stream &o, bool tableFormat) const
CountAccumulator & operator++()
ContainedAccumulator< Atomicity, Args... > prime_type
std::ostream & print(std::ostream &o, std::string_view tag) const override
prints the counter to a stream in table format, with the given tag
Base type for all functors used as ValuesHandler.
BufferableCounter(BufferableCounter const &)=delete
AccumulatorSet & operator+=(const InputType by)
friend void reset(SigmaCounter &c)
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.
ValueHandler::InternalType m_value
MsgCounter(MsgCounter const &)=delete
Monitoring::Hub * m_monitoringHub
A counter aiming at computing average and sum2 / variance / standard deviation.
static constexpr OutputType DefaultValue()
void mergeAndReset(AccumulatorSet< Arithmetic, Ato, InputType, Bases... > &other)
static constexpr OutputType getValue(const InternalType &v) noexcept
virtual bool toBePrinted() const
hint whether we should print that counter or not.
BufferableCounter & operator=(BufferableCounter const &)=delete
GenericAccumulator(InnerType in)
friend void mergeAndReset(StatCounter &c, StatCounter &o)
AccumulatorSet is an Accumulator that holds a set of Accumulators templated by same Arithmetic and At...
A basic integral counter;.
MsgCounter(OWNER *o, std::string const &ms, unsigned long nMax=10)
AveragingCounter(OWNER *o, std::string const &name)
static Arithmetic exchange(InternalType &v, Arithmetic newv) noexcept
static StatCounter fromJSON(const nlohmann::json &j)
MsgStream & print(MsgStream &os, bool tableFormat) const override
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
virtual ~PrintableCounter()=default
destructor
static constexpr OutputType getValue(const InternalType &v) noexcept
std::string toString() const
get a string representation
BufferableCounter()=default
friend void to_json(nlohmann::json &j, BinomialCounter const &c)
bool toBePrinted() const override
hint whether we should print that counter or not.
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
static void merge(InternalType &a, Arithmetic b) noexcept
GenericAccumulator(std::in_place_t, Args &&... args)
friend void reset(MsgCounter &c)
static Counter fromJSON(const nlohmann::json &j)
virtual MsgStream & print(MsgStream &, bool tableFormat=true) const =0
MsgCounter & operator++()
A counter aiming at computing sum and average.
PrintableCounter()=default
Buffer(const Buffer &)=delete
friend void mergeAndReset(Counter &c, Counter &o)
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
AccumulatorSet(construct_empty_t, const AccumulatorSet< Arithmetic, ato, InputType, Bases... > &)
constructor of an empty AccumulatorSet, copying the (non existent) config from another GenericAccumul...
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
virtual std::ostream & print(std::ostream &o, std::string_view tag) const
prints the counter to a stream in table format, with the given tag
BinomialAccumulator & operator+=(binomial_t b)
BinomialCounter(OWNER *o, std::string const &name)
void operator+(AccumulatorSet< Arithmetic, Ato, InputType, Bases... > &&other)
MsgCounter & operator=(MsgCounter const &)=delete
stream & printImpl(stream &o, bool tableFormat) const
helper functor for the TrueAccumulator
MsgCounter(OWNER *o, std::string const &ms, int nMax)
AveragingAccumulatorBase.
static Arithmetic exchange(InternalType &v, Arithmetic newv) noexcept
ContainedAccumulator< atomicity::none, Args... > base_type
SigmaCounter(OWNER *o, std::string const &name)
Counter & operator+=(const Arithmetic v)
BufferableCounter(OWNER *o, std::string const &name)
static InternalType extractJSONDataHelper(const nlohmann::json &j, typename Bases< Atomicity, Arithmetic >::JSONStringEntriesType... entries)
MsgCounter & operator+=(const bool by)
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
GenericAccumulator operator+=(const InputType by)
StatCounter(OWNER *o, std::string const &name)
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
Arithmetic nEntries() const
An Extremum ValueHandler, to be reused for Minimum and Maximum operator(a, b) means if (Compare(b,...
IntegralAccumulator & operator++()
stream & printImpl(stream &o, bool tableFormat) const
An Adder ValueHandler operator(a, b) means a += b.
CountAccumulator operator++(int)
constexpr bool has_fetch_add_v
auto unbiased_sample_variance() const
auto efficiencyErr() const
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
static void from_json(const json &j, std::chrono::duration< Rep, Period > &d)
friend void reset(Counter &c)
static constexpr OutputType DefaultValue()
stream & printImpl(stream &o, std::string_view tag) const
std::tuple< typename Bases< Atomicity, Arithmetic >::InternalType... > InternalType
static constexpr OutputType DefaultValue()
friend void reset(StatCounter &c)
GenericAccumulator(construct_empty_t, const GenericAccumulator< InputType, InnerType, ato, InputTransform, OutputTransform, VH > &)
constructor of an empty GenericAccumulator, copying the (non existent) config from another GenericAcc...
friend class GenericAccumulator
static const std::string typeString
std::decay_t< std::result_of_t< Identity(unsigned long)> > OutputType
GenericAccumulator & operator=(const GenericAccumulator &other)
GenericAccumulator< bool, unsigned long, Atomicity, Identity, Identity, Handler< Atomicity > > MsgAccumulator
A counter dealing with binomial data.
static void merge(typename Base::InternalType &orig, bool b)
void registerEntity(std::string c, std::string n, std::string t, T &ent)
static void merge(InternalType &a, Arithmetic b) noexcept
static InternalType extractJSONDataHelper(const nlohmann::json &j, const JSONStringEntriesType &entries, std::index_sequence< Is... >)
void operator=(const Buffer &)=delete
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
void mergeAndReset(GenericAccumulator< InputType, InnerType, ato, InputTransform, OutputTransform, VH > &other)
std::ostream & print(std::ostream &os, bool tableFormat) const override
prints the counter to a stream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
void removeEntity(T &ent)
CountAcc< Atomicity, Arithmetic >::InputType InputType
unsigned long nFalseEntries() const
constexpr AccumulatorSet()=default
Generic Accumulator, templated by.
BufferableCounter(OWNER *o, std::string const &name, SELF &self, CARGS... args)
A functor always returning the value N.
friend void mergeAndReset(BinomialCounter &c, BinomialCounter &o)
static void to_json(json &j, const std::chrono::duration< Rep, Period > &d)
MsgStream & msgStream() const
Return an uninitialized MsgStream.
bool toBePrinted() const override
hint whether we should print that counter or not.
An empty ancester of all counters that provides a buffer method that returns a buffer on itself Also ...
static const std::string typeString
friend void to_json(nlohmann::json &j, SigmaCounter const &c)
GenericAccumulator()=default
int merge(const char *target, const char *source, bool fixup=false, bool dbg=true)
stream & printImpl(stream &o, bool tableFormat) const
static const std::string typeString
std::conditional_t< std::is_integral_v< Arithmetic >, Result, Arithmetic > fp_result_type
type_trait for the result type of a floating point operation on the type Arithmetic
AccumulatorSet(const InternalType &t)
friend void to_json(nlohmann::json &j, AveragingCounter const &c)
virtual MsgStream & print(MsgStream &o, std::string_view tag) const
std::ostream & operator<<(std::ostream &os, const duration< Rep, Period > &d)
stream operator for std::chrono::duration including unit
static InnerType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
bool toBePrinted() const override
hint whether we should print that counter or not.
auto standard_deviation() const
construct_empty_t()=default
constexpr construct_empty_t construct_empty
helper functor for the FalseAccumulator
static BinomialCounter fromJSON(const nlohmann::json &j)
void reset(const InternalType &t)
Buffer is a non atomic Accumulator which, when it goes out-of-scope, updates the underlying thread-sa...
unsigned long nEntries() const
void operator+(GenericAccumulator< InputType, InnerType, ato, InputTransform, OutputTransform, VH > &&other)
stream & printImpl(stream &o, bool tableFormat) const
bool toBePrinted() const override
hint whether we should print that counter or not.
atomicity
Defines atomicity of the accumulators.
void fetch_add(AtomicType &atVar, Arithmetic value)
generic fetch_add, also dealing with atomic types with no fetch_add member method
static void merge(InternalType &a, Arithmetic b) noexcept
GenericAccumulator(const GenericAccumulator &other)
static constexpr OutputType DefaultValue()
A counter aiming at computing average and sum2 / variance / standard deviation.
constant used to disambiguate construction of an empty Accumulator versus the copy constructor.
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
unsigned long nEntries() const
stream & printImpl(stream &o, bool tableFormat) const
static SigmaCounter fromJSON(const nlohmann::json &j)
auto biased_sample_variance() const
unsigned long nTrueEntries() const
friend void reset(BinomialCounter &c)
virtual std::ostream & print(std::ostream &, bool tableFormat=false) const =0
prints the counter to a stream
Central entity in a Gaudi application that manages monitoring objects (i.e.
unsigned int operator()(bool v) const
Counter(OWNER *o, std::string const &name)
IntegralAccumulator operator++(int)
static void merge(InternalType &a, Arithmetic b) noexcept
unsigned int operator()(bool v) const
static const std::string typeString
MsgStream & print(MsgStream &o, std::string_view tag) const override
friend void mergeAndReset(AveragingCounter &c, AveragingCounter &o)
bool toBePrinted() const override
hint whether we should print that counter or not.
friend void to_json(nlohmann::json &j, StatCounter const &c)
static MsgCounter fromJSON(const nlohmann::json &j)
static AveragingCounter fromJSON(const nlohmann::json &j)
bool toBePrinted() const override
hint whether we should print that counter or not.
constexpr T operator()(U &&) const noexcept
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 buff...
decltype(auto) operator+(const T &v, const Property< TP, V, H > &p)
implemantation of (value + property)
static const std::string typeString
friend void to_json(nlohmann::json &j, Counter const &c)
std::ostream & operator<<(std::ostream &s, const PrintableCounter &counter)
external printout operator to a stream type
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
friend void to_json(nlohmann::json &j, MsgCounter const &c)
friend void mergeAndReset(SigmaCounter &c, SigmaCounter &o)
friend void reset(AveragingCounter &c)
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
decltype(std::declval< T & >().fetch_add(0)) has_fetch_add_
type_traits for checking the presence of fetch_add