timing a function

Started by
3 comments, last by Catafriggm 18 years, 11 months ago
I am looking for a way to time how long a set of function take to perform there actions. What is the best what of doing this?
Advertisement
Maybe check out the DevPartner profiler. It's free, and really good IMHO.
is there something a little simple to inplement, like a function. i am using time() but is there something that give me like milli-seconds?
Here's something for you to take a look at [wink]. It uses the most accurate timer avaliable on Windows.
void WINAPI GetCycleCount(ULARGE_INTEGER &ulCycleCount){     __asm      { 	push ecx        rdtsc         mov ecx, ulCycleCount         mov DWORD PTR[ecx], eax         mov DWORD PTR[ecx+4], edx 	pop ecx     } }

That gives you the CPU cycle counter. Should be accurate to within 20 cycles.

This topic is closed to new replies.

Advertisement