discussion forum
message
| Name: |
unknown |
| Date: |
September 30, 2003 at 19:39:04 |
| Subject: |
Re: Question about RDTSC programming |
| In Reply To: |
Re: Question about RDTSC programming by unknown on September 30, 2003 at 16:15:05 |
| 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. |
post a followup message
(Be nice... or be blocked. Be technical... or be erased.)
currently posted followup messages
(You may have to press the RELOAD button of your browser.)
|