From 8c5f06c37f3c267ecd8f867cd49765c366b5f47c Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Thu, 18 Aug 2022 23:11:29 -0400 Subject: many additions --- debug.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'debug.h') diff --git a/debug.h b/debug.h index e2df239..5863298 100644 --- a/debug.h +++ b/debug.h @@ -15,6 +15,10 @@ union debugval { int32 i; }; +enum PerfID { + perf_renderframe +}; + // things that get cleared every frame with the UI struct debug_temp { @@ -28,16 +32,22 @@ struct project_debug { debug_temp Temp; bool32 ToggleWindow; + uint64 PixelCountTransparent; + uint64 PixelCountRendered; + uint64 PixelCountChecked; + // NOTE(fox): Pixel count isn't thread safe; don't use with multithreading! + uint64 LayerCycleCount[64]; }; static project_debug Debug; -#if ARM -#define DEBUG_CycleCountStart(ID) -#define DEBUG_CycleCountEnd(ID) + +#if DEBUG +#define Debug_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc(); +#define Debug_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++; #else -#define DEBUG_CycleCountStart(ID) Debug.CycleCount[ID] = __rdtsc(); -#define DEBUG_CycleCountEnd(ID) Debug.EndCycleCount[ID] += __rdtsc() - Debug.CycleCount[ID]; Debug.ExecutionAmount[ID]++; +#define Debug_CycleCountStart(ID) +#define Debug_CycleCountEnd(ID) #endif static void @@ -80,3 +90,17 @@ DebugWatchVar(char *Name, void *Address, valtype Type) { } #endif +#ifdef PERF + +struct perf_stats +{ + uint64 PixelCountTransparent; + uint64 PixelCountRendered; + uint64 PixelCountChecked; +}; + +static perf_stats Perf; +static uint64 Test; + +#endif + -- cgit v1.2.3