Loading [MathJax]/extensions/tex2jax.js
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__ )
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 using OutputType = std::decay_t<std::invoke_result_t<OutputTransform, InnerType>>;
486 template <atomicity ato,
typename VH>
490 template <
typename... Args>
499 template <atomicity ato,
typename VH>
503 template <atomicity ato,
typename VH>
513 return j.at( entries ).get<InnerType>();
517 typename ValueHandler::InternalType
m_value{ ValueHandler::DefaultValue() };
525 template <
typename Arithmetic,
atomicity Atomicity,
typename InputTypeT = Arithmetic,
526 template <atomicity,
typename>
class... Bases>
535 template <atomicity ato>
539 ( Bases<Atomicity, Arithmetic>::operator+=( by ), ... );
543 void reset() { ( Bases<Atomicity, Arithmetic>::reset(), ... ); }
544 template <atomicity Ato>
546 ( Bases<Atomicity, Arithmetic>::mergeAndReset(
static_cast<Bases<Ato, Arithmetic>&
>( other ) ), ... );
548 template <atomicity Ato>
556 std::apply( [
this](
const auto&... i ) { ( this->Bases<Atomicity, Arithmetic>::reset( i ), ... ); },
t );
563 template <
size_t... Is>
565 std::index_sequence<Is...> ) {
570 typename Bases<Atomicity, Arithmetic>::JSONStringEntriesType... entries ) {
571 return { Bases<Atomicity, Arithmetic>::extractJSONData(
j, entries )... };
579 template <atomicity Atomicity,
typename Arithmetic =
double>
581 :
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Maximum<Arithmetic, Atomicity>> {
591 template <atomicity Atomicity,
typename Arithmetic =
double>
593 :
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Minimum<Arithmetic, Atomicity>> {
605 template <atomicity Atomicity,
typename Arithmetic =
double>
609 ( *this ) += Arithmetic{};
624 template <atomicity Atomicity,
typename Arithmetic =
double>
635 template <atomicity Atomicity,
typename Arithmetic =
unsigned long>
637 static_assert( std::is_integral_v<Arithmetic>,
638 "Invalid Arithmetic type for IntegralAccumulator. It must be an integral type" );
658 template <atomicity Atomicity,
typename Arithmetic =
double>
674 template <atomicity Atomicity,
typename Arithmetic>
690 template <atomicity Atomicity,
typename Arithmetic>
701 template <atomicity Atomicity,
typename Arithmetic>
706 template <
typename Result = fp_result_type<Arithmetic>>
709 if ( 1 > nbEntries )
return Result{ -1 };
710 return static_cast<Result
>( this->
nTrueEntries() ) / nbEntries;
714 template <
typename Result = fp_result_type<Arithmetic>>
721 if ( 1 > nbEntries )
return Result{ -1 };
722 return sqrt(
static_cast<Result
>( this->
nTrueEntries() * this->nFalseEntries() ) / nbEntries ) / nbEntries;
731 assert( b.nPass <= b.nTotal );
745 template <atomicity Atomicity,
typename Arithmetic,
template <atomicity,
typename>
typename CountAcc,
746 template <atomicity,
typename>
typename SumAcc>
748 :
AccumulatorSet<Arithmetic, Atomicity, typename CountAcc<Atomicity, Arithmetic>::InputType, CountAcc, SumAcc> {
749 static_assert( std::is_same_v<
typename CountAcc<Atomicity, Arithmetic>::InputType,
750 typename SumAcc<Atomicity, Arithmetic>::InputType>,
751 "Incompatible Counters in definition of AveragingAccumulator. Both should have identical Input" );
754 template <
typename Result = fp_result_type<Arithmetic>>
756 auto n = this->nEntries();
757 Result sum = this->sum();
758 return (
n > 0 ) ?
static_cast<Result
>( sum /
n ) : Result{};
766 template <atomicity Atomicity,
typename Arithmetic>
774 template <atomicity Atomicity,
typename Arithmetic,
template <atomicity,
typename>
typename AvgAcc,
775 template <atomicity,
typename>
typename SquareAcc>
777 :
AccumulatorSet<Arithmetic, Atomicity, typename AvgAcc<Atomicity, Arithmetic>::InputType, AvgAcc, SquareAcc> {
778 static_assert( std::is_same_v<
typename AvgAcc<Atomicity, Arithmetic>::InputType,
779 typename SquareAcc<Atomicity, Arithmetic>::InputType>,
780 "Incompatible Counters in definition of SigmaAccumulator. Both should have identical Input" );
783 template <
typename Result = fp_result_type<Arithmetic>>
785 auto n = this->nEntries();
786 Result sum = this->sum();
787 return (
n > 0 ) ?
static_cast<Result
>( ( this->sum2() - sum * ( sum /
n ) ) /
n ) : Result{};
790 template <
typename Result = fp_result_type<Arithmetic>>
792 auto n = this->nEntries();
793 Result sum = this->sum();
794 return (
n > 1 ) ?
static_cast<Result
>( ( this->sum2() - sum * ( sum /
n ) ) / (
n - 1 ) ) : Result{};
797 template <
typename Result = fp_result_type<Arithmetic>>
804 return ( Result{ 0 } >
v ) ? Result{} :
static_cast<Result
>(
sqrt(
v ) );
806 [[deprecated(
"The name 'rms' has changed to standard_deviation" )]] Arithmetic
rms()
const {
810 template <
typename Result = fp_result_type<Arithmetic>>
812 auto n = this->nEntries();
813 if ( 0 ==
n )
return Result{};
819 return ( Result{ 0 } >
v ) ? Result{} :
static_cast<Result
>(
sqrt(
v /
n ) );
827 template <atomicity Atomicity,
typename Arithmetic>
834 template <atomicity Atomicity,
typename Arithmetic>
844 template <
template <
atomicity Ato,
typename...
Int>
class ContainedAccumulator,
atomicity Atomicity, typename... Args>
845 class Buffer :
public ContainedAccumulator<atomicity::none, Args...> {
856 if ( m_prime ) { m_prime->mergeAndReset(
static_cast<base_type&
>( *
this ) ); }
873 template <
typename stream>
906 template <
atomicity Atomicity,
template <
atomicity Ato,
typename...
Int>
class Accumulator, typename... Args>
909 using Accumulator<Atomicity, Args...>::Accumulator;
912 template <
typename OWNER>
918 if ( m_monitoringHub ) { m_monitoringHub->removeEntity( *
this ); }
924 template <
typename OWNER,
typename SELF,
typename... CARGS>
926 : Accumulator<Atomicity, Args...>(
args... ), m_monitoringHub( &o->serviceLocator()->monitoringHub() ) {
927 m_monitoringHub->registerEntity( o->name(),
name,
self.typeString,
self );
938 template <atomicity Atomicity = atomicity::full,
typename Arithmetic =
unsigned long>
942 template <
typename OWNER>
952 template <
typename stream>
955 auto fmt = ( tableFormat ?
"|%|10d| |" :
"#=%|-7lu|" );
967 j = { {
"type",
c.typeString }, {
"empty",
c.nEntries() == 0 }, {
"nEntries",
c.nEntries() } };
978 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
981 typeid( Arithmetic ).
name() };
983 template <
typename OWNER>
988 template <
typename stream>
990 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |" :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g|" );
999 bool toBePrinted()
const override {
return this->nEntries() > 0; }
1003 j = { {
"type",
c.typeString },
1004 {
"empty",
c.nEntries() == 0 },
1005 {
"nEntries",
c.nEntries() },
1007 {
"mean",
c.mean() } };
1013 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1020 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1024 template <
typename OWNER>
1029 template <
typename stream>
1031 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |"
1032 :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g|" );
1044 j = { {
"type",
c.typeString },
1045 {
"empty",
c.nEntries() == 0 },
1046 {
"nEntries",
c.nEntries() },
1048 {
"mean",
c.mean() },
1049 {
"sum2",
c.sum2() },
1050 {
"standard_deviation",
c.standard_deviation() } };
1061 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1065 template <
typename OWNER>
1070 template <
typename stream>
1072 auto fmt = ( tableFormat ?
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |"
1073 :
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" );
1074 return o <<
boost::format{
fmt } % this->nEntries() % this->sum() % this->mean() % this->standard_deviation() %
1075 this->min() % this->max();
1086 j = { {
"type",
c.typeString },
1087 {
"empty",
c.nEntries() == 0 },
1088 {
"nEntries",
c.nEntries() },
1090 {
"mean",
c.mean() },
1091 {
"sum2",
c.sum2() },
1092 {
"standard_deviation",
c.standard_deviation() },
1094 {
"max",
c.max() } };
1098 j, { { {
"nEntries",
"sum" },
"sum2" },
"min",
"max" } );
1106 template <
typename Arithmetic =
double, atomicity Atomicity = atomicity::full>
1109 typeid( Arithmetic ).
name() };
1111 template <
typename OWNER>
1115 template <
typename stream>
1117 auto fmt = ( tableFormat ?
"|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%% |"
1118 :
"#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|" );
1128 template <
typename stream>
1132 return print( o,
true );
1141 j = { {
"type",
c.typeString },
1142 {
"empty",
c.nEntries() == 0 },
1143 {
"nEntries",
c.nTrueEntries() +
c.nFalseEntries() },
1144 {
"nTrueEntries",
c.nTrueEntries() },
1145 {
"nFalseEntries",
c.nFalseEntries() },
1146 {
"efficiency",
c.efficiency() },
1147 {
"efficiencyErr",
c.efficiencyErr() } };
1154 namespace details::MsgCounter {
1155 template <atomicity Atomicity>
1158 static void merge(
typename Base::InternalType& orig,
bool b ) {
1164 template <atomicity Atomicity,
typename Arithmetic =
double>
1168 template <MSG::Level level, atomicity Atomicity = atomicity::full>
1172 template <
typename OWNER>
1177 template <
typename OWNER>
1193 template <
typename stream>
1195 return o <<
boost::format{ tableFormat ?
"|%|10d| |" :
"#=%|-7lu|" } % this->
value();
1204 j = { {
"type",
c.typeString }, {
"empty",
c.value() == 0 },
1205 {
"nEntries",
c.value() }, {
"level",
level },
1206 {
"max",
c.max }, {
"msg",
c.msg } };
1209 return {
j.at(
"msg" ).get<
std::string>(),
j.at(
"max" ).get<
unsigned long>(),
1210 j.at(
"nEntries" ).get<
unsigned long>() };
1223 if ( this->
value() == max ) {
1237 template <
typename Counter,
typename Container,
typename Fun>
1240 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
ostream & operator<<(ostream &s, const MyCustomType &m)
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
std::decay_t< std::invoke_result_t< Identity, unsigned long > > OutputType
static const std::string typeString
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
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