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 πŸ‘‘


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