discussion forum



message

Name: unknown
Date: October 01, 2003 at 14:56:57
Subject: Re: Question about RDTSC programming
In Reply To: Re: Question about RDTSC programming by
unknown on October 01, 2003 at 11:33:18
Text: ||||| To calculate the CPU speed you need to use the 8254 timer (ports 40h-43h)
||||| It has a resolution of 838ns and is the same on all PCs and has been so
||||| since the original IBM PC. Depending on what you're doing you might want
||||| to just use the 8254 timer in your game engine.
|||||
||||| The link points to Intel's CPUID document which includes code to calculate
||||| the CPU speed. Getting the bus speed and multiplier involves reading MSRs
||||| and is different between processor families. You shouldn't really need that
||||| info anyway in a game engine.
|||||
||||
|||| Hey thanks for getting back to me, I will look into that doc. Ya I shouldnt need to access the MSR but i thought I could get the speed by Bus x multiplier but if this way works thats great. How accurate is it? Thanks
||||
||| Using the 8254 timer and RDTSC to time a small sequence of code is very
||| accurate. You can accurately calculate CPU speed to at least 0.1 Mhz,
||| probably 0.01 Mhz.
|||
||
|| Does the method in the document you gave me a link to utilize 8245? I dont see any referance to it. I cant seem to find any article specific to this timer over at intels page. If it isnt utilized in that doc do you have any sources that would have information it it? Thanks
||
| They're using the BIOS timer tick counter (dword at offset 046Ch) which is
| updated 18.2 times a second from 8254 timer 0 so they are using it but just
| not directly. Some programs directly use 8254 timer 2 (port 42h) to time an
| interval and use RDTSC to count cycles, basically it's the same thing -
| count elasped cycles for a code sequence via RDTSC and find out how much
| time it took via a known constant time reference (the 8254 timer) and compute
| the CPU speed from the ratio.
|
Hi again sorry to be bugging u guys so much hehe. I was reading over the doc again and noticed you needed ring 0 support so my next question i supose would be is it possible for me to get ring zero support in Windows and if so how?
Thanks



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