19  template <
class Rep, 
class Period>
 
   20  auto sqrt( std::chrono::duration<Rep, Period> d );
 
   21  template <
class Rep1, 
class Rep2, 
class Period>
 
   22  auto operator*( 
const std::chrono::duration<Rep1, Period>& lhs, 
const std::chrono::duration<Rep2, Period>& rhs );
 
 
   26#if defined( __GNUC__ ) && ( __GNUC__ == 11 ) && !defined( __clang__ ) 
   27namespace std::chrono {
 
   28  template <
typename Ratio>
 
   29  static constexpr const char* suffix( 
const Ratio& ) {
 
   30    if constexpr ( std::ratio_equal_v<Ratio, std::ratio<1>> ) {
 
   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>> ) {
 
   40    } 
else if constexpr ( std::ratio_equal_v<Ratio, std::ratio<3600>> ) {
 
   45  template <
class Rep, 
class Period>
 
   46  std::ostream& 
operator<<( std::ostream& os, 
const std::chrono::duration<Rep, Period>& d ) {
 
   47    return os << d.count() << suffix( Period{} );
 
  235#include <boost/format.hpp> 
  239#include <nlohmann/json.hpp> 
  242#include <type_traits> 
  250  template <
class Rep, 
class Period>
 
  251  struct adl_serializer<
std::chrono::duration<Rep, Period>> {
 
  252    static void to_json( json& j, 
const std::chrono::duration<Rep, Period>& d ) { j = d.count(); }
 
  253    static void from_json( 
const json& j, std::chrono::duration<Rep, Period>& d ) {
 
  254      d = std::chrono::duration<Rep, Period>{ j.get<Rep>() };
 
 
 
 
  271  template <
typename T, T N>
 
  273    template <
typename U>
 
 
  283    template <
typename U>
 
  284    constexpr decltype( auto ) 
operator()( U&& v ) 
const noexcept {
 
  285      return std::forward<U>( v );
 
 
 
  293    template <
typename U>
 
  294    constexpr decltype( auto ) 
operator()( U&& v ) 
const noexcept {
 
 
 
  302  template <
typename Arithmetic, 
typename Result = 
double>
 
  303  using fp_result_type = std::conditional_t<std::is_integral_v<Arithmetic>, Result, Arithmetic>;
 
  308  template <
typename Arithmetic, atomicity Atomicity>
 
  314  template <
typename Arithmetic>
 
  325  template <
typename Arithmetic>
 
  330      return v.load( std::memory_order_relaxed );
 
 
 
  339  template <
typename Arithmetic, atomicity Atomicity>
 
  345  template <
typename Arithmetic>
 
  356  template <
typename AtomicType, 
typename Arithmetic>
 
  358    if constexpr ( 
requires { atVar.fetch_add( value, std::memory_order_relaxed ); } ) {
 
  359      atVar.fetch_add( value, std::memory_order_relaxed );
 
  362      while ( !atVar.compare_exchange_weak( current, current + value ) )
 
 
  370  template <
typename Arithmetic>
 
  376      if constexpr ( !std::is_floating_point_v<Arithmetic> ) { 
 
 
 
  387  template <
typename Arithmetic, atomicity Atomicity, 
typename Compare, Arithmetic ( *Initial )()>
 
  393  template <
typename Arithmetic, 
typename Compare, Arithmetic ( *Initial )()>
 
  399      if ( Compare{}( b, a ) ) a = b;
 
 
 
  406  template <
typename Arithmetic, 
typename Compare, Arithmetic ( *Initial )()>
 
  413      while ( Compare{}( b, prev_value ) && !a.compare_exchange_weak( prev_value, b ) )
 
 
 
  422  template <
typename Arithmetic, atomicity Atomicity = atomicity::full>
 
  429  template <
typename Arithmetic, atomicity Atomicity = atomicity::full>
 
  460            typename InputTransform = Identity, 
typename OutputTransform = Identity,
 
  461            typename ValueHandler = Adder<InnerType, Atomicity>>
 
  463    template <
typename, 
typename, atomicity, 
typename, 
typename, 
typename>
 
  468    using OutputType            = std::decay_t<std::invoke_result_t<OutputTransform, InnerType>>;
 
  472      ValueHandler::merge( 
m_value, InputTransform{}( by ) );
 
 
  477    template <atomicity ato, 
typename VH>
 
  481    template <
typename... Args>
 
  490    template <atomicity ato, 
typename VH>
 
  492      ValueHandler::merge( 
m_value, VH::exchange( other.
m_value, VH::DefaultValue() ) );
 
 
  494    template <atomicity ato, 
typename VH>
 
  496      ValueHandler::merge( 
m_value, other.m_value );
 
 
  504      return j.at( entries ).get<InnerType>();
 
 
  508    typename ValueHandler::InternalType 
m_value{ ValueHandler::DefaultValue() };
 
 
  516  template <
typename Arithmetic, 
atomicity Atomicity, 
typename InputTypeT = Arithmetic,
 
  517            template <atomicity, 
typename> 
class... Bases>
 
  521    using OutputType            = std::tuple<typename Bases<Atomicity, Arithmetic>::OutputType...>;
 
  522    using InternalType          = std::tuple<typename Bases<Atomicity, Arithmetic>::InternalType...>;
 
  526    template <atomicity ato>
 
  530      ( Bases<Atomicity, Arithmetic>::operator+=( by ), ... );
 
 
  533    OutputType value()
 const { 
return std::make_tuple( Bases<Atomicity, Arithmetic>::value()... ); }
 
  534    void       reset() { ( Bases<Atomicity, Arithmetic>::reset(), ... ); }
 
  535    template <atomicity Ato>
 
  537      ( Bases<Atomicity, Arithmetic>::mergeAndReset( 
static_cast<Bases<Ato, Arithmetic>&
>( other ) ), ... );
 
 
  539    template <atomicity Ato>
 
  541      ( Bases<Atomicity, Arithmetic>::operator+( 
static_cast<Bases<Ato, Arithmetic>&&
>( other ) ), ... );
 
 
  547      std::apply( [
this]( 
const auto&... i ) { ( this->Bases<Atomicity, Arithmetic>::reset( i ), ... ); }, t );
 
 
  550      return extractJSONDataHelper( j, entries, std::index_sequence_for<Bases<Atomicity, Arithmetic>...>{} );
 
 
  554    template <
size_t... Is>
 
  556                                               std::index_sequence<Is...> ) {
 
 
  561                           typename Bases<Atomicity, Arithmetic>::JSONStringEntriesType... entries ) {
 
  562      return { Bases<Atomicity, Arithmetic>::extractJSONData( j, entries )... };
 
 
 
  570  template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
  572      : 
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Maximum<Arithmetic, Atomicity>> {
 
 
  582  template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
  584      : 
GenericAccumulator<Arithmetic, Arithmetic, Atomicity, Identity, Identity, Minimum<Arithmetic, Atomicity>> {
 
 
  596  template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
  600      ( *this ) += Arithmetic{};
 
 
 
  615  template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
  626  template <atomicity Atomicity, 
typename Arithmetic = 
unsigned long>
 
  628    static_assert( std::is_integral_v<Arithmetic>,
 
  629                   "Invalid Arithmetic type for IntegralAccumulator. It must be an integral type" );
 
 
  649  template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
  665  template <atomicity Atomicity, 
typename Arithmetic>
 
  681  template <atomicity Atomicity, 
typename Arithmetic>
 
  692  template <atomicity Atomicity, 
typename Arithmetic>
 
  697    template <
typename Result = fp_result_type<Arithmetic>>
 
  700      if ( 1 > nbEntries ) 
return Result{ -1 };
 
  701      return static_cast<Result
>( this->
nTrueEntries() ) / nbEntries;
 
 
  705    template <
typename Result = fp_result_type<Arithmetic>>
 
  712      if ( 1 > nbEntries ) 
return Result{ -1 };
 
  713      return sqrt( 
static_cast<Result
>( this->
nTrueEntries() * this->nFalseEntries() ) / nbEntries ) / nbEntries;
 
 
  722      assert( b.nPass <= b.nTotal );
 
 
 
  736  template <atomicity Atomicity, 
typename Arithmetic, 
template <atomicity, 
typename> 
typename CountAcc,
 
  737            template <atomicity, 
typename> 
typename SumAcc>
 
  739      : 
AccumulatorSet<Arithmetic, Atomicity, typename CountAcc<Atomicity, Arithmetic>::InputType, CountAcc, SumAcc> {
 
  740    static_assert( std::is_same_v<typename CountAcc<Atomicity, Arithmetic>::InputType,
 
  741                                  typename SumAcc<Atomicity, Arithmetic>::InputType>,
 
  742                   "Incompatible Counters in definition of AveragingAccumulator. Both should have identical Input" );
 
  743    using AccumulatorSet<Arithmetic, Atomicity, 
typename CountAcc<Atomicity, Arithmetic>::InputType, CountAcc,
 
  745    template <
typename Result = fp_result_type<Arithmetic>>
 
  747      auto   n   = this->nEntries();
 
  748      Result sum = this->sum();
 
  749      return ( n > 0 ) ? 
static_cast<Result
>( sum / n ) : Result{};
 
 
 
  757  template <atomicity Atomicity, 
typename Arithmetic>
 
  765  template <atomicity Atomicity, 
typename Arithmetic, 
template <atomicity, 
typename> 
typename AvgAcc,
 
  766            template <atomicity, 
typename> 
typename SquareAcc>
 
  768      : 
AccumulatorSet<Arithmetic, Atomicity, typename AvgAcc<Atomicity, Arithmetic>::InputType, AvgAcc, SquareAcc> {
 
  769    static_assert( std::is_same_v<typename AvgAcc<Atomicity, Arithmetic>::InputType,
 
  770                                  typename SquareAcc<Atomicity, Arithmetic>::InputType>,
 
  771                   "Incompatible Counters in definition of SigmaAccumulator. Both should have identical Input" );
 
  772    using AccumulatorSet<Arithmetic, Atomicity, 
typename SquareAcc<Atomicity, Arithmetic>::InputType, AvgAcc,
 
  774    template <
typename Result = fp_result_type<Arithmetic>>
 
  776      auto   n   = this->nEntries();
 
  777      Result sum = this->sum();
 
  778      return ( n > 0 ) ? 
static_cast<Result
>( ( this->sum2() - sum * ( sum / n ) ) / n ) : Result{};
 
 
  781    template <
typename Result = fp_result_type<Arithmetic>>
 
  783      auto   n   = this->nEntries();
 
  784      Result sum = this->sum();
 
  785      return ( n > 1 ) ? 
static_cast<Result
>( ( this->sum2() - sum * ( sum / n ) ) / ( n - 1 ) ) : Result{};
 
 
  788    template <
typename Result = fp_result_type<Arithmetic>>
 
  795      return ( Result{ 0 } > v ) ? Result{} : 
static_cast<Result
>( 
sqrt( v ) );
 
 
  797    [[deprecated( 
"The name 'rms' has changed to standard_deviation" )]] Arithmetic 
rms()
 const {
 
 
  801    template <
typename Result = fp_result_type<Arithmetic>>
 
  803      auto n = this->nEntries();
 
  804      if ( 0 == n ) 
return Result{};
 
  810      return ( Result{ 0 } > v ) ? Result{} : 
static_cast<Result
>( 
sqrt( v / n ) );
 
 
 
  818  template <atomicity Atomicity, 
typename Arithmetic>
 
  825  template <atomicity Atomicity, 
typename Arithmetic>
 
  835  template <
template <
atomicity Ato, 
typename... Int> 
class ContainedAccumulator, 
atomicity Atomicity, typename... Args>
 
  836  class Buffer : 
public ContainedAccumulator<atomicity::none, Args...> {
 
 
  864    template <
typename stream>
 
  865    stream& 
printImpl( stream& s, std::string_view tag )
 const {
 
  866      s << boost::format{ 
" | %|-48.48s|%|50t|" } % ( std::string{ 
'\"' }.append( tag ).append( 
"\"" ) );
 
  867      return print( s, 
true );
 
 
  870    virtual std::ostream& 
print( std::ostream&, 
bool tableFormat = 
false ) 
const = 0;
 
  873    virtual std::ostream& 
print( std::ostream& o, std::string_view tag )
 const { 
return printImpl( o, tag ); }
 
  880      std::ostringstream ost;
 
 
 
  897  template <
atomicity Atomicity, 
template <
atomicity Ato, 
typename... Int> 
class Accumulator, typename... Args>
 
  900    using Accumulator<Atomicity, Args...>::Accumulator;
 
  903    template <
typename OWNER>
 
  915    template <
typename OWNER, 
typename SELF, 
typename... CARGS>
 
  917        : Accumulator<Atomicity, Args...>( args... ), 
m_monitoringHub( &o->serviceLocator()->monitoringHub() ) {
 
  918      m_monitoringHub->registerEntity( o->name(), name, self.typeString, self );
 
 
 
  929  template <atomicity Atomicity = atomicity::full, 
typename Arithmetic = 
unsigned long>
 
  931    inline static const std::string 
typeString{ std::string{ 
"counter:Counter:" } + 
typeid( Arithmetic ).name() };
 
  933    template <
typename OWNER>
 
  943    template <
typename stream>
 
  944    stream& 
printImpl( stream& o, 
bool tableFormat )
 const {
 
  946      auto fmt = ( tableFormat ? 
"|%|10d| |" : 
"#=%|-7lu|" );
 
  947      return o << boost::format{ fmt } % this->
nEntries();
 
 
  950    std::ostream& 
print( std::ostream& o, 
bool tableFormat = 
false )
 const override {
 
 
  958      j = { { 
"type", c.typeString }, { 
"empty", c.nEntries() == 0 }, { 
"nEntries", c.nEntries() } };
 
 
 
  969  template <
typename Arithmetic = 
double, atomicity Atomicity = atomicity::full>
 
  971    inline static const std::string 
typeString{ std::string{ 
"counter:AveragingCounter:" } +
 
  972                                                typeid( Arithmetic ).name() };
 
 
  974    template <
typename OWNER>
 
  979    template <
typename stream>
 
  980    stream& 
printImpl( stream& o, 
bool tableFormat )
 const {
 
  981      auto fmt = ( tableFormat ? 
"|%|10d| |%|11.7g| |%|#11.5g| |" : 
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g|" );
 
  982      return o << boost::format{ fmt } % this->nEntries() % this->sum() % this->
mean();
 
 
  985    std::ostream& 
print( std::ostream& o, 
bool tableFormat = 
false )
 const override {
 
 
  990    bool        toBePrinted()
 const override { 
return this->nEntries() > 0; }
 
  994      j = { { 
"type", c.typeString },
 
  995            { 
"empty", c.nEntries() == 0 },
 
  996            { 
"nEntries", c.nEntries() },
 
  998            { 
"mean", c.mean() } };
 
 
 
 1004  template <
typename Arithmetic = 
double, atomicity Atomicity = atomicity::full>
 
 1011  template <
typename Arithmetic = 
double, atomicity Atomicity = atomicity::full>
 
 1013    inline static const std::string 
typeString{ std::string{ 
"counter:SigmaCounter:" } + 
typeid( Arithmetic ).name() };
 
 1015    template <
typename OWNER>
 
 1020    template <
typename stream>
 
 1022      auto fmt = ( tableFormat ? 
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |" 
 1023                               : 
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g|" );
 
 1024      return o << boost::format{ fmt } % this->nEntries() % this->sum() % this->mean() % this->
standard_deviation();
 
 
 1027    std::ostream& 
print( std::ostream& o, 
bool tableFormat = 
false )
 const override {
 
 
 1035      j = { { 
"type", c.typeString },
 
 1036            { 
"empty", c.nEntries() == 0 },
 
 1037            { 
"nEntries", c.nEntries() },
 
 1039            { 
"mean", c.mean() },
 
 1040            { 
"sum2", c.sum2() },
 
 1041            { 
"standard_deviation", c.standard_deviation() } };
 
 
 
 1052  template <
typename Arithmetic = 
double, atomicity Atomicity = atomicity::full>
 
 1054    inline static const std::string 
typeString{ std::string{ 
"counter:StatCounter:" } + 
typeid( Arithmetic ).name() };
 
 1056    template <
typename OWNER>
 
 1061    template <
typename stream>
 
 1063      auto fmt = ( tableFormat ? 
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" 
 1064                               : 
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" );
 
 1065      return o << boost::format{ fmt } % this->nEntries() % this->sum() % this->mean() % this->
standard_deviation() %
 
 1066                      this->min() % this->max();
 
 
 1069    std::ostream& 
print( std::ostream& o, 
bool tableFormat = 
false )
 const override {
 
 
 1077      j = { { 
"type", c.typeString },
 
 1078            { 
"empty", c.nEntries() == 0 },
 
 1079            { 
"nEntries", c.nEntries() },
 
 1081            { 
"mean", c.mean() },
 
 1082            { 
"sum2", c.sum2() },
 
 1083            { 
"standard_deviation", c.standard_deviation() },
 
 1085            { 
"max", c.max() } };
 
 
 1089          j, { { { 
"nEntries", 
"sum" }, 
"sum2" }, 
"min", 
"max" } );
 
 
 
 1097  template <
typename Arithmetic = 
double, atomicity Atomicity = atomicity::full>
 
 1099    inline static const std::string 
typeString{ std::string{ 
"counter:BinomialCounter:" } +
 
 1100                                                typeid( Arithmetic ).name() };
 
 
 1102    template <
typename OWNER>
 
 1106    template <
typename stream>
 
 1108      auto fmt = ( tableFormat ? 
"|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%% |" 
 1109                               : 
"#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|" );
 
 
 1114    std::ostream& 
print( std::ostream& o, 
bool tableFormat = 
false )
 const override {
 
 
 1119    template <
typename stream>
 
 1120    stream& 
printImpl( stream& o, std::string_view tag )
 const {
 
 1122      o << boost::format{ 
" |*%|-48.48s|%|50t|" } % ( std::string{ 
"\"" }.append( tag ).append( 
"\"" ) );
 
 1123      return print( o, 
true );
 
 
 1126    std::ostream& 
print( std::ostream& o, std::string_view tag )
 const override { 
return printImpl( o, tag ); }
 
 1132      j = { { 
"type", c.typeString },
 
 1133              { 
"empty", c.nEntries() == 0 },
 
 1134              { 
"nEntries", c.nTrueEntries() + c.nFalseEntries() },
 
 1135              { 
"nTrueEntries", c.nTrueEntries() },
 
 1136              { 
"nFalseEntries", c.nFalseEntries() },
 
 1137              { 
"efficiency", c.efficiency() },
 
 1138              { 
"efficiencyErr", c.efficiencyErr() } };
 
 
 
 1146    template <atomicity Atomicity>
 
 1149      static void merge( 
typename Base::InternalType& orig, 
bool b ) {
 
 1150        if ( b ) Base::merge( orig, 1 );
 
 
 
 1155    template <atomicity Atomicity, 
typename Arithmetic = 
double>
 
 
 1159  template <MSG::Level level, atomicity Atomicity = atomicity::full>
 
 1162    inline static const std::string 
typeString{ 
"counter:MsgCounter" };
 
 1163    template <
typename OWNER>
 
 1164    MsgCounter( OWNER* o, std::string 
const& ms, 
unsigned long nMax = 10 )
 
 
 1182    template <
typename stream>
 
 1184      return o << boost::format{ tableFormat ? 
"|%|10d| |" : 
"#=%|-7lu|" } % this->
value();
 
 
 1187    std::ostream& 
print( std::ostream& os, 
bool tableFormat )
 const override { 
return printImpl( os, tableFormat ); }
 
 1193      j = { { 
"type", c.typeString },  { 
"empty", c.value() == 0 },
 
 1194              { 
"nEntries", c.value() }, { 
"level", level },
 
 1195              { 
"max", c.max },          { 
"msg", c.msg } };
 
 
 1198      return { j.at( 
"msg" ).get<std::string>(), j.at( 
"max" ).get<
unsigned long>(),
 
 1199               j.at( 
"nEntries" ).get<
unsigned long>() };
 
 
 1203    MsgCounter( std::string 
const& ms, 
unsigned long nMax, 
unsigned long count )
 
 
 1212        if ( this->
value() == max ) {
 
 1213          logger->msgStream( level ) << 
"Suppressing message: " << std::quoted( 
msg, 
'\'' ) << 
endmsg;
 
 
 1226  template <
typename Counter, 
typename Container, 
typename Fun>
 
 1228    auto b = counter.buffer();
 
 1229    for ( 
const auto& elem : container ) b += f( elem );
 
 
 
 
std::ostream & operator<<(std::ostream &s, AlgsExecutionStates::State x)
Streaming of State values.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
AccumulatorSet is an Accumulator that holds a set of Accumulators templated by same Arithmetic and At...
static InternalType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
static InternalType extractJSONDataHelper(const nlohmann::json &j, const JSONStringEntriesType &entries, std::index_sequence< Is... >)
void operator+(AccumulatorSet< Arithmetic, Ato, InputType, Bases... > &&other)
std::tuple< typename Bases< Atomicity, Arithmetic >::InternalType... > InternalType
std::tuple< typename Bases< Atomicity, Arithmetic >::OutputType... > OutputType
AccumulatorSet(const InternalType &t)
static InternalType extractJSONDataHelper(const nlohmann::json &j, typename Bases< Atomicity, Arithmetic >::JSONStringEntriesType... entries)
constexpr AccumulatorSet()=default
void mergeAndReset(AccumulatorSet< Arithmetic, Ato, InputType, Bases... > &other)
void reset(const InternalType &t)
AccumulatorSet & operator+=(const InputType by)
AccumulatorSet(construct_empty_t, const AccumulatorSet< Arithmetic, ato, InputType, Bases... > &)
constructor of an empty AccumulatorSet, copying the (non existent) config from another GenericAccumul...
std::tuple< typename Bases< Atomicity, Arithmetic >::JSONStringEntriesType... > JSONStringEntriesType
Buffer is a non atomic Accumulator which, when it goes out-of-scope, updates the underlying thread-sa...
ContainedAccumulator< Atomicity, Args... > prime_type
ContainedAccumulator< atomicity::none, Args... > base_type
void operator=(const Buffer &)=delete
Buffer(const Buffer &)=delete
An empty ancester of all counters that provides a buffer method that returns a buffer on itself Also ...
Monitoring::Hub * m_monitoringHub
BufferableCounter()=default
static const std::string typeString
BufferableCounter(OWNER *o, std::string const &name, SELF &self, CARGS... args)
Buffer< Accumulator, Atomicity, Args... > BufferType
BufferableCounter & operator=(BufferableCounter const &)=delete
BufferableCounter(BufferableCounter const &)=delete
BufferableCounter(OWNER *o, std::string const &name)
Generic Accumulator, templated by.
GenericAccumulator & operator=(const GenericAccumulator &other)
GenericAccumulator(const GenericAccumulator &other)
GenericAccumulator(InnerType in)
GenericAccumulator(std::in_place_t, Args &&... args)
Handler< Atomicity >::InternalType m_value
std::decay_t< std::invoke_result_t< OutputTransform, InnerType > > OutputType
static InnerType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
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...
void mergeAndReset(GenericAccumulator< InputType, InnerType, ato, InputTransform, OutputTransform, VH > &other)
void operator+(GenericAccumulator< InputType, InnerType, ato, InputTransform, OutputTransform, VH > &&other)
std::string JSONStringEntriesType
GenericAccumulator()=default
GenericAccumulator operator+=(const InputType by)
friend class GenericAccumulator
std::ostream & print(std::ostream &os, bool tableFormat) const override
prints the counter to a stream
friend void to_json(nlohmann::json &j, MsgCounter const &c)
friend void reset(MsgCounter &c)
MsgCounter & operator++()
MsgCounter(OWNER *o, std::string const &ms, unsigned long nMax=10)
bool toBePrinted() const override
hint whether we should print that counter or not.
stream & printImpl(stream &o, bool tableFormat) const
friend void mergeAndReset(MsgCounter &c, MsgCounter &o)
Monitoring::Hub * m_monitoringHub
static MsgCounter fromJSON(const nlohmann::json &j)
static const std::string typeString
const CommonMessagingBase * logger
MsgCounter & operator+=(const bool by)
MsgStream & print(MsgStream &os, bool tableFormat) const override
MsgCounter(MsgCounter const &)=delete
MsgCounter & operator=(MsgCounter const &)=delete
MsgCounter(std::string const &ms, unsigned long nMax, unsigned long count)
Definition of the MsgStream class used to transmit messages.
GenericAccumulator< bool, unsigned long, Atomicity, Identity, Identity, Handler< Atomicity > > MsgAccumulator
Efficient counter implementations for Gaudi.
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.
std::ostream & operator<<(std::ostream &s, const PrintableCounter &counter)
external printout operator to a stream type
AccumulatorSet< Arithmetic, Atomicity, Arithmetic, SigmaAccumulator, MinAccumulator, MaxAccumulator > StatAccumulator
StatAccumulator.
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Extremum< Arithmetic, Atomicity, std::less< Arithmetic >, std::numeric_limits< Arithmetic >::max > Minimum
A Minimun ValueHandler operator(a, b) means a = min(a, b) In case of full atomicity,...
Extremum< Arithmetic, Atomicity, std::greater< Arithmetic >, std::numeric_limits< Arithmetic >::lowest > Maximum
An Maximum ValueHandler operator(a, b) means a = max(a, b) In case of full atomicity,...
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...
AveragingCounter< Arithmetic, Atomicity > SummingCounter
atomicity
Defines atomicity of the accumulators.
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
constexpr construct_empty_t construct_empty
AveragingAccumulatorBase< Atomicity, Arithmetic, CountAccumulator, SumAccumulator > AveragingAccumulator
AveragingAccumulator.
void fetch_add(AtomicType &atVar, Arithmetic value)
generic fetch_add, also dealing with atomic types with no fetch_add member method
SigmaAccumulatorBase< Atomicity, Arithmetic, AveragingAccumulator, SquareAccumulator > SigmaAccumulator
SigmaAccumulator.
An Adder ValueHandler operator(a, b) means a += b.
static constexpr OutputType DefaultValue()
static void merge(InternalType &a, Arithmetic b) noexcept
static constexpr OutputType DefaultValue()
static void merge(InternalType &a, Arithmetic b) noexcept
AveragingAccumulatorBase.
A counter aiming at computing sum and average.
stream & printImpl(stream &o, bool tableFormat) const
friend void mergeAndReset(AveragingCounter &c, AveragingCounter &o)
bool toBePrinted() const override
hint whether we should print that counter or not.
AveragingCounter(OWNER *o, std::string const &name)
static const std::string typeString
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
friend void to_json(nlohmann::json &j, AveragingCounter const &c)
static AveragingCounter fromJSON(const nlohmann::json &j)
friend void reset(AveragingCounter &c)
Base type for all functors used as ValuesHandler.
static constexpr OutputType getValue(const InternalType &v) noexcept
std::atomic< Arithmetic > InternalType
static Arithmetic exchange(InternalType &v, Arithmetic newv) noexcept
static constexpr OutputType getValue(const InternalType &v) noexcept
static Arithmetic exchange(InternalType &v, Arithmetic newv) noexcept
BinomialAccumulator & operator+=(binomial_t b)
auto efficiencyErr() const
unsigned long nEntries() const
friend void to_json(nlohmann::json &j, BinomialCounter const &c)
BinomialCounter(OWNER *o, std::string const &name)
stream & printImpl(stream &o, bool tableFormat) const
friend void mergeAndReset(BinomialCounter &c, BinomialCounter &o)
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
MsgStream & print(MsgStream &o, std::string_view tag) const override
static BinomialCounter fromJSON(const nlohmann::json &j)
static const std::string typeString
friend void reset(BinomialCounter &c)
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
bool toBePrinted() const override
hint whether we should print that counter or not.
stream & printImpl(stream &o, std::string_view tag) const
A functor always returning the value N.
constexpr T operator()(U &&) const noexcept
CountAccumulator operator++(int)
unsigned long nEntries() const
CountAccumulator & operator++()
A basic integral counter;.
friend void mergeAndReset(Counter &c, Counter &o)
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
Counter(OWNER *o, std::string const &name)
static Counter fromJSON(const nlohmann::json &j)
Counter & operator+=(const Arithmetic v)
friend void reset(Counter &c)
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
bool toBePrinted() const override
hint whether we should print that counter or not.
stream & printImpl(stream &o, bool tableFormat) const
friend void to_json(nlohmann::json &j, Counter const &c)
static const std::string typeString
An Extremum ValueHandler, to be reused for Minimum and Maximum operator(a, b) means if (Compare(b,...
static void merge(InternalType &a, Arithmetic b) noexcept
static constexpr OutputType DefaultValue()
static void merge(InternalType &a, Arithmetic b) noexcept
static constexpr OutputType DefaultValue()
unsigned long nFalseEntries() const
helper functor for the FalseAccumulator
unsigned int operator()(bool v) const
IntegralAccumulator operator++(int)
Arithmetic nEntries() const
IntegralAccumulator & operator++()
An empty ancester of all counters that knows how to print themselves.
virtual ~PrintableCounter()=default
destructor
std::string toString() const
get a string representation
virtual std::ostream & print(std::ostream &, bool tableFormat=false) const =0
prints the counter to a stream
stream & printImpl(stream &s, std::string_view tag) const
virtual MsgStream & print(MsgStream &, bool tableFormat=true) const =0
PrintableCounter()=default
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
virtual bool toBePrinted() const
hint whether we should print that counter or not.
virtual MsgStream & print(MsgStream &o, std::string_view tag) const
auto biased_sample_variance() const
auto unbiased_sample_variance() const
auto standard_deviation() const
stream & printImpl(stream &o, bool tableFormat) const
bool toBePrinted() const override
hint whether we should print that counter or not.
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
friend void to_json(nlohmann::json &j, SigmaCounter const &c)
SigmaCounter(OWNER *o, std::string const &name)
friend void reset(SigmaCounter &c)
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
friend void mergeAndReset(SigmaCounter &c, SigmaCounter &o)
static const std::string typeString
static SigmaCounter fromJSON(const nlohmann::json &j)
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
friend void mergeAndReset(StatCounter &c, StatCounter &o)
stream & printImpl(stream &o, bool tableFormat) const
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
friend void reset(StatCounter &c)
friend void to_json(nlohmann::json &j, StatCounter const &c)
static StatCounter fromJSON(const nlohmann::json &j)
bool toBePrinted() const override
hint whether we should print that counter or not.
StatCounter(OWNER *o, std::string const &name)
static const std::string typeString
unsigned long nTrueEntries() const
helper functor for the TrueAccumulator
unsigned int operator()(bool v) const
constant used to disambiguate construction of an empty Accumulator versus the copy constructor.
construct_empty_t()=default
static void merge(typename Base::InternalType &orig, bool b)
Adder< unsigned long, Atomicity > Base
Central entity in a Gaudi application that manages monitoring objects (i.e.
static void from_json(const json &j, std::chrono::duration< Rep, Period > &d)
static void to_json(json &j, const std::chrono::duration< Rep, Period > &d)