data.counter.saturating ≡
template <auto Width> class saturating_counter §
Increment-only counter that will saturate rather than overflow.
Aliases
-
using count_t = uint<Width> §
Methods
-
saturating_counter::count_t increment(saturating_counter::count_t inc_amount, bool clear_before_inc) §
Increment the counter with an optional clear before increment. Return the value before the increment/clear. Returning the value before clear is useful when offloading the value to some external store, for example periodic sampling of performance counters.
-
inline saturating_counter::count_t get() §
Get the current value of the counter.