Overte C++ Documentation
gpu::Metric< T > Class Template Reference

#include <Metric.h>

Public Member Functions

T getValue ()
 
T getMaximum ()
 
void set (T newValue)
 Set metric to a new value. More...
 
void increment ()
 Increment stored value by one.
 
void decrement ()
 Decrement stored value by one.
 
void update (T prevValue, T newValue)
 Atomically subtract previous value from the metric and add new one. More...
 
void reset ()
 Resets current metric value and maximum value to zero.
 

Detailed Description

template<typename T>
class gpu::Metric< T >

Used for simple, thread-safe statistics such as counting resources.

Template Parameters
TData type for the metric. Common ones are uint32_t and size_t.

Member Function Documentation

◆ getMaximum()

template<typename T >
T gpu::Metric< T >::getMaximum ( )
inline
Returns
Returns maximum value that the metric had.

◆ getValue()

template<typename T >
T gpu::Metric< T >::getValue ( )
inline
Returns
Returns the current value of the metric.

◆ set()

template<typename T >
void gpu::Metric< T >::set ( T  newValue)
inline

Set metric to a new value.

Does not reset or update maximum value.

Parameters
newValueNew value.

◆ update()

template<typename T >
void gpu::Metric< T >::update ( T  prevValue,
T  newValue 
)
inline

Atomically subtract previous value from the metric and add new one.

Update maximum value if needed.

Parameters
prevValuePrevious value.
newValueNew value.

The documentation for this class was generated from the following file: