data.counter.saturating


template <auto Width>
class saturating_counter §source

Increment-only counter that will saturate rather than overflow.

Aliases

Methods

  • saturating_counter::count_t
    increment(saturating_counter::count_t inc_amount, bool clear_before_inc) §source
    

    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() §source
    

    Get the current value of the counter.