|
perfc 0.11.0
|
Integrals w/o timestamp Partial specialization for integral types T and without clock. More...
#include <perfc/counter.hpp>
Integrals w/o timestamp Partial specialization for integral types T and without clock.
Represents a thread safe performance counter primitive of type T.
Satisfies AtomicCounter requirements.
| T | counter value type. Type requirements:
|
Definition at line 140 of file counter.hpp.
Public Types | |
| using | ClockType = void |
| using | TimePointType = void |
| using | ValueType = T |
| using | CounterType = std::atomic<T> |
Public Member Functions | |
| Counter () noexcept | |
Construct with value-initialized T (T()) | |
| Counter (T value) noexcept | |
| Construct with initial value value. | |
| Counter (Counter const &)=delete | |
| bool | IsLockFree () const noexcept |
| Query if operations are lock free. | |
| void | Store (T value, MemoryOrder order=MemoryOrder::Release) noexcept |
| Stores provided value in counter. | |
| T | Load (MemoryOrder order=MemoryOrder::Acquire) const noexcept |
| Load value from counter. | |
| T | FetchAdd (T value, MemoryOrder order=MemoryOrder::Release) noexcept |
| Perform post-increment with current value and value. | |
| T | FetchSub (T value, MemoryOrder order=MemoryOrder::Release) noexcept |
| Load value from counter. | |
| T | operator++ () noexcept |
| Pre-increment operator using default memory order. | |
| T | operator++ (int) noexcept |
| Post-increment operator using default memory order. | |
| T | operator-- () noexcept |
| Pre-decrement operator using default memory order. | |
| T | operator-- (int) noexcept |
| Post-decrement operator using default memory order. | |
| T | operator+= (T value) noexcept |
Performs addition (equivalent to FetchAdd(value) + value | |
| T | operator-= (T value) noexcept |
Performs subtraction (equivalent to FetchSub(value) - value | |
Static Public Attributes | |
| static constexpr bool | IS_ALWAYS_LOCK_FREE = CounterType::is_always_lock_free |
| Is true if counter is always lock free. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| enum | MemoryOrder |
| Memory ordering constraints. More... | |
| using perfc::Counter< T, void, typename std::enable_if< std::is_integral< T >::value >::type >::ClockType = void |
Definition at line 142 of file counter.hpp.
| using perfc::Counter< T, void, typename std::enable_if< std::is_integral< T >::value >::type >::CounterType = std::atomic<T> |
Definition at line 145 of file counter.hpp.
| using perfc::Counter< T, void, typename std::enable_if< std::is_integral< T >::value >::type >::TimePointType = void |
Definition at line 143 of file counter.hpp.
| using perfc::Counter< T, void, typename std::enable_if< std::is_integral< T >::value >::type >::ValueType = T |
Definition at line 144 of file counter.hpp.
|
inlineexplicitnoexcept |
Construct with value-initialized T (T())
Definition at line 155 of file counter.hpp.
|
inlineexplicitnoexcept |
Construct with initial value value.
| value | Initial value. |
Definition at line 163 of file counter.hpp.
|
delete |
|
inlinenoexcept |
Perform post-increment with current value and value.
| value | value to add. |
| order | Memory order constraints. |
Definition at line 203 of file counter.hpp.
|
inlinenoexcept |
Load value from counter.
| value | value to subtract. |
| order | Memory order constraints. |
Definition at line 215 of file counter.hpp.
|
inlinenoexcept |
Query if operations are lock free.
Definition at line 172 of file counter.hpp.
|
inlinenodiscardnoexcept |
Load value from counter.
| order | Memory order constraints. |
Definition at line 192 of file counter.hpp.
|
inlinenoexcept |
Pre-increment operator using default memory order.
Definition at line 222 of file counter.hpp.
|
inlinenoexcept |
Post-increment operator using default memory order.
Definition at line 231 of file counter.hpp.
|
inlinenoexcept |
Performs addition (equivalent to FetchAdd(value) + value
| value | value to add. |
Definition at line 257 of file counter.hpp.
|
inlinenoexcept |
Pre-decrement operator using default memory order.
Definition at line 238 of file counter.hpp.
|
inlinenoexcept |
Post-decrement operator using default memory order.
Definition at line 247 of file counter.hpp.
|
inlinenoexcept |
Performs subtraction (equivalent to FetchSub(value) - value
| value | value to subtract. |
Definition at line 267 of file counter.hpp.
|
inlinenoexcept |
Stores provided value in counter.
| value | Counter value to store. |
| order | Memory order constraints. |
Definition at line 182 of file counter.hpp.
|
Memory ordering constraints.
Definition at line 81 of file counter.hpp.
|
staticconstexpr |
Is true if counter is always lock free.
Definition at line 150 of file counter.hpp.