discussion forum



message

Name: Petr
Date: October 02, 2003 at 14:28:00
Subject: Re: Question about RDTSC programming
In Reply To: Question about RDTSC programming by
Jag on September 30, 2003 at 15:08:16
Text: Hi!
Feel free to use this method. It detects frequency very very fast and very acurate. Only for Win32, though it can be modified easily for any OS !


---

procedure ZjistitFrekvenciRDTSC;
var tsc_prvni, tsc_druhy : LARGE_INTEGER;
casA, casB, timer_rychlost : int64;
begin
timer_rychlost:=1;
QueryPerformanceFrequency(timer_rychlost);
asm
rdtsc
mov tsc_prvni.LowPart, eax
mov tsc_prvni.HighPart, edx
end;
QueryPerformanceCounter(casA);

Sleep(50); // 50 ms sleeping

asm
rdtsc
mov tsc_druhy.LowPart, eax
mov tsc_druhy.HighPart, edx
end;
QueryPerformanceCounter(casB);

writeln('Frequency (RDTSC) is: ', (tsc_druhy.QuadPart-tsc_prvni.QuadPart) / ((casB-casA)/(timer_rychlost)), ' Hz');

end;




post a followup message
(Be nice... or be blocked. Be technical... or be erased.)

Name: optional link title:
eMail: optional link URL:
Subject: optional image URL:
  Insert line breaks by hand when only about one inch remains at the right side. Otherwise your message will be unreadable.
Text:
 

  Note: The above eMail form fields may look unaligned if you are using a browser other than Netscape Navigator version 3.0.



currently posted followup messages
(You may have to press the RELOAD button of your browser.)




main page