#pragma once
#include <string>
#include <cstdint>
#ifndef VVL_ENABLE_SYNCVAL_STATS
#define VVL_ENABLE_SYNCVAL_STATS …
#endif
#if VVL_ENABLE_SYNCVAL_STATS != 0
#include <atomic>
#endif
namespace syncval_stats {
#if VVL_ENABLE_SYNCVAL_STATS != 0
struct Value32 {
std::atomic_uint32_t u32;
void Update(uint32_t new_value);
uint32_t Add(uint32_t n);
uint32_t Sub(uint32_t n);
};
struct ValueMax32 {
Value32 value;
Value32 max_value;
void Update(uint32_t new_value);
void Add(uint32_t n);
void Sub(uint32_t n);
};
struct Stats {
~Stats();
bool report_on_destruction = false;
ValueMax32 command_buffer_context_counter;
void AddCommandBufferContext();
void RemoveCommandBufferContext();
ValueMax32 handle_record_counter;
void AddHandleRecord(uint32_t count = 1);
void RemoveHandleRecord(uint32_t count = 1);
void ReportOnDestruction();
std::string CreateReport();
};
#else
struct Stats { … };
#endif
}