Original Post
🔒 Locked
Profiling Question
Advertisement
Well, since you all took so long I knocked one up myself, somewhat influenced by J.M.McGuiness' CCPUTicker Library. here goes:
Hope this is useful to someone :)
LARGE_INTEGER current,finish,onesecond; double tot_freq = 0, avg_freq = 0; __int64 s_tsc,f_tsc; QueryPerformanceFrequency(&onesecond); for (int n = 0; n < numloops; n++) { QueryPerformanceCounter(&finish); finish.QuadPart+=onesecond.QuadPart; { __asm cpuid __asm rdtsc __asm mov dword ptr [s_tsc], eax __asm mov dword ptr [s_tsc+4], edx } do { QueryPerformanceCounter(¤t); } while(current.QuadPart<finish.QuadPart); { __asm cpuid __asm rdtsc __asm mov dword ptr [f_tsc], eax __asm mov dword ptr [f_tsc+4], edx } tot_freq += (double)(f_tsc - s_tsc); } m_dCPUFreq = tot_freq / numloops;Hope this is useful to someone :)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement