If it's for PC (wellpost pentium) then can't you just use the RDTSC - read time stamp counter. Something similar must exist on the Mac,etc so you could wrap in it in a function pointer or #define.
It'll give you accuracy to the hertz (as in megahertz).
There's Intel link here:
http://cedar.intel.com/cgi-bin/ids.dll/content/content.jsp?cntKey=Legacy::irtp_RDTSCPM1_12033&cntType=IDS_EDITORIAL
Or just search for RDTSC on google
Edited by - chrisflatley on February 17, 2002 6:43:18 PM
Fast timer, NOT win32
__int64 __declspec(naked) __fastcall RDTSC() { _asm { cpuid rdtsc ret } }
Declare the __int64''s you stuff the result into as volatile __int64.
Problem is you need to first time the CPU using one of the timing function in order to determine the clock MHz - which is needed to measure time with rdtsc. (You need the processor pack for MSVC6 for this to compile).
Magmai Kai Holmlor
"Oh, like you''ve never written buggy code" - Lee
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement