Logging & timeSDL 3.2
SDL_GetPerformanceCounter
Reads the finest timer the system has, in ticks of unknown size. For profiling.
Signature
Uint64 SDL_GetPerformanceCounter(void);
How it works
The counter alone means nothing: its unit depends on the machine. Take two readings, subtract them, and divide by SDL_GetPerformanceFrequency (ticks per second) to get seconds.
Use it to measure how long a piece of code takes. For game time, SDL_GetTicksNS is simpler and usually just as precise.
Return value
The current counter value, in platform ticks.
Example
example.cpp
1Uint64 start = SDL_GetPerformanceCounter();
2buildNavMesh();
3double ms = 1000.0 * double(SDL_GetPerformanceCounter() - start)
4 / double(SDL_GetPerformanceFrequency());
5SDL_Log("navmesh: %.3f ms", ms);