SDL_GetPerformanceCounter(3)
π SDL_GetPerformanceCounter(3) π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, this one's about timing and it's lowkey iconic β¨
πΈ NAME πΈ
SDL_GetPerformanceCounter β get the current value of the high resolution counter π
π SYNOPSIS π
#include <SDL3/SDL_timer.h>
Uint64 SDL_GetPerformanceCounter(void);
like, that's it. no args. she takes nothing and gives you a number. queen behavior honestly π
β¨ DESCRIPTION β¨
So bestie, this function is typically used for profiling π₯ like when you wanna know how long your code is taking, this is your girl.
π¨ IMPORTANT VIBE CHECK π¨ the counter values are only meaningful relative to each other. you cannot just stare at one number and be like "wow that means something" because it does not. periodt.
If you wanna turn those differences into actual times, you gotta use SDL_GetPerformanceFrequency(). That's the conversion girlie. She's in SEE ALSO. iykyk π
π¦ RETURN VALUE π¦
Returns the current counter value. that's the whole thing. that's the tea βοΈ
π§ THREAD SAFETY π§
It is safe to call this function from any thread. yes bestie, ANY thread. go wild. call it from all of them. she can handle it π«Ά
π AVAILABILITY π
This function is available since SDL 3.2.0 β so if you're on something older... no she's not there yet, sorry babe π
π SEE ALSO π
SDL_GetPerformanceFrequency(3)β the other half of the duo, go read her too π
mwah that's the page!! this came from the SDL 3.4.18 era of the Simple Directmedia Layer docs, and it was a whole pleasure to walk you through it. go profile something and slay π β¨π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms