11 #ifndef hifi_gpu_Metric_h
12 #define hifi_gpu_Metric_h
20 std::atomic<T> _value { 0 };
21 std::atomic<T> _maximum { 0 };
24 T getValue() {
return _value; }
25 T getMaximum() {
return _maximum; }
27 void set(T newValue) {
31 auto total = ++_value;
32 if (total > _maximum.load()) {
40 void update(T prevValue, T newValue) {
41 if (prevValue == newValue) {
44 if (newValue > prevValue) {
45 auto total = _value.fetch_add(newValue - prevValue);
46 if (total > _maximum.load()) {
50 _value.fetch_sub(prevValue - newValue);
60 using ContextMetricCount = Metric<uint32_t>;
61 using ContextMetricSize = Metric<Size>;