I have been failing at my Google-fu and havent really found out what the preferred/best/fastest/most exact way is to measure time and produce sleep?
So to the questions:
Edit: might be that a few of those were SDL funcions like Delay and GetTicks?? My Bad.
Take a look on what Nim uses for it's realtime GC. In special, this file: https://github.com/Araq/Nim/blob/devel/lib/system/timers.nim
And yes, it should be exposed in a library. I was writing this: https://github.com/ReneSac/Benchmark
It is for nimrod 0.9.4, needs update. And I was planning to change it completely to use more accurate time measuring, but stopped halfway.
Thank you Renesac,
Well it seems that GetTicks is indead the one available with the highest resolution (on windows) and cpuTime is infact a wrapper for clock() which seems flakey with its update intervals and thus precision. Wouldn't a GetCycles function in system, mapping directly to __rdtscp (windows) and rdtsc (linux), be pretty handy?
EDIT: my understanding of asm is obviously crap. Could we test if there is a C lib call like __rdtscp in intrin.h and then use that or is it better to go directly to asm and see if there is an rdtscp call available (how) and call that?
Are there some gotchas that I miss?