21#include <boost/type_traits/type_identity.hpp>
728class Histogram_counter;
851template<
typename Stat_set>
852struct Stat_set_printable;
854template<
typename Stat_set_t,
size_t N>
856template<
typename Tag_t,
typename Stat_set_t,
size_t N = 1>
878const T&
load(
const T& val);
892T
load(
const std::atomic<T>& val);
919void store(T* target_val,
const boost::type_identity_t<T>& val);
934void store(std::atomic<T>* target_val, boost::type_identity_t<T> val);
964void fetch_add(T* target_val,
const boost::type_identity_t<T>& addend_val);
990T
fetch_add(std::atomic<T>* target_val, boost::type_identity_t<T> addend_val);
1008void fetch_sub(T* target_val,
const boost::type_identity_t<T>& subtrahend_val);
1026T
fetch_sub(std::atomic<T>* target_val, boost::type_identity_t<T> subtrahend_val);
1045T
exchange(std::atomic<T>* target_val, boost::type_identity_t<T> val);
1065void update_hi_wmark(T* target_val,
const boost::type_identity_t<T>& val);
1083void update_hi_wmark(std::atomic<T>* target_val, boost::type_identity_t<T> val);
1099void reset(T* target_val,
const T& fresh_val);
1112void reset(Histogram_counter* target_val,
const Histogram_counter& fresh_val);
1128template<
typename Stat_set>
1154template<
typename Stat_set,
typename... Ctor_args>
1198template<
typename Stat_set>
1199void stats_reset(Stat_set* target_stats,
const Stat_set& fresh_stats);
1226template<
typename Stat_set>
1227void stats_assign(Stat_set* target_stats,
const Stat_set& src_stats);
1263template<
typename Stat_set>
1299template<
typename Stat_set,
typename It>
1300void stats_aggregate(Stat_set* target_stats,
const It& src_stats_begin,
const It& src_stats_end);
1357template<
typename Stat_set,
typename It>
1358void stats_sum(Stat_set* target_stats,
const It& src_stats_begin,
const It& src_stats_end);
1506template<
typename Stat_set,
typename It>
1508 const Stat_set* fresh_stats_from_0_shards);
1553template<
typename Stat_set,
typename It>
1555 const Stat_set& fresh_stats_from_0_shards);
1639template<
typename Stat_set>
1655template<
typename Stat_set>
1673template<
typename Stat_set>
1674Stat_set_printable<Stat_set>
print(
const Stat_set& stats);
1687template<
typename Stat_set>
1688std::ostream&
operator<<(std::ostream& os,
const Stat_set_printable<Stat_set>& printable);
1701std::ostream&
operator<<(std::ostream& os,
const Histogram_counter& val);
Sub-module of flow::util providing lightweight facilities for working with simple structs of stat cou...
void stats_mark_reset_state(Stat_set *target_stats)
Sets each HI_WMARK-declared stat-member in *target_stats to its gauged-stat's current value in *targe...
Stat_type
Describes an individual member of a Stat_set, as decided by the user (you) via FLOW_UTIL_STAT_DECLARE...
@ S_HI_WMARK
Value of the same type as a specific other value stats.m_v in the same Stat_set with Stat_type S_GAUG...
@ S_GAUGE
Value (often numeric) that represents the state of something at some point in time.
@ S_ACCUMULATOR
Value (typically numeric, or conceptually a collection of numerics) that counts/tallies (typically vi...
void fetch_sub(T *target_val, const boost::type_identity_t< T > &subtrahend_val)
Default fetch_sub(&target_stats.m_val, _val) that simply applies *target_val -= subtrahend_val.
void stats_aggregate_shards(Stat_set *target_stats, const It &src_stats_begin, const It &src_stats_end, const Stat_set *fresh_stats_from_0_shards)
Sharded-stats consumption: Aggregates N source Stat_sets, interpreted as shards of the aggregated who...
void update_hi_wmark(T *target_val, const boost::type_identity_t< T > &val)
Default update_hi_wmark(&target_stats.m_val, val) that updates *target_val to val if and only if the ...
void stats_sum(Stat_set *target_stats, const It &src_stats_begin, const It &src_stats_end)
Equivalent to stats_aggregate() as-if every stat, regardless of its actual stat::Stat_type,...
void stats_aggregate_one(Stat_set *target_stats, const Stat_set &src_stats)
Aggregates the values from src_stats into *target_stats, in-place.
const T & load(const T &val)
Default load(stats.m_val) that simply return stats.m_val.
void stats_assign(Stat_set *target_stats, const Stat_set &src_stats)
Given a source Stat_set, makes the target Stat_set equal to the former.
void reset(Histogram_counter *target_val, const Histogram_counter &)
Executes target_val->clear(), where *target_val is a Histogram_counter.
void stats_reset_shard_aggregate(Stat_set *target_stats, const It &src_stats_begin, const It &src_stats_end, const Stat_set &fresh_stats_from_0_shards)
Reset-stats companion to stats_aggregate_shards(); together the two functions provide support for the...
void fetch_add(T *target_val, const boost::type_identity_t< T > &addend_val)
Default fetch_add(&target_stats.m_val, addend_val) that simply applies *target_val += addend_val.
void stats_since_reset_state(Stat_set *target_stats, Stat_set *reset_state)
Intended for situations where the source of stat readings – including ACCUMULATORs and not just GAUGE...
void stats_aggregate(Stat_set *target_stats, const It &src_stats_begin, const It &src_stats_end)
Aggregates N source Stat_sets – drawn from the iterator range [src_stats_begin, src_stats_end) – into...
std::vector< std::string > stats_field_names(Ctor_args &&... ctor_args)
Returns the names of all declared stats of the given Stat_set type, in declaration order: the same na...
T exchange(std::atomic< T > *target_val, boost::type_identity_t< T > val)
Equivalent to target_val->exchange(val, memory_order_relaxed); sets *target_val to val and returns th...
std::ostream & operator<<(std::ostream &os, const Histogram_counter &val)
Prints string representation of the given Histogram_counter to the given ostream.
void stats_to_ostream(std::ostream &os, const Stat_set &stats)
Outputs a human-readable representation of all declared stats in stats to the given ostream.
void stats_reset(Stat_set *target_stats, const Stat_set &fresh_stats)
With the help of a freshly-initialized Stat_set, resets the target Stat_set so as to immediately begi...
Stat_set_printable< Stat_set > print(const Stat_set &stats)
Returns a lightweight proxy object that, when streamed via operator<<, pretty-prints the given Stat_s...
void store(T *target_val, const boost::type_identity_t< T > &val)
Default store(&target_stats.m_val, val) that simply assigns *target_val = val.