Welcome to Intel® Software Network Quick Login | Join | Help |
Search in Intel® Software Network Forums
in Go

Excuting time of the instruction "rdtsc" on X86

Last post 03-13-2008, 7:21 AM by dhbellwyc. 4 replies.
Sort Posts: Previous Next
 03-11-2008, 5:12 AM 30250597  

Excuting time of the instruction "rdtsc" on X86

I made an experiment on testing one "mov to/from registers" instructions,  key souce code lists below:

int i;

_asm{

   rdtsc; 
   mov ebx,eax; 
   rdtsc; 
   sub eax,ebx; 
   mov i,eax;

}

finally, prints the value of i, on my machine i is 80.

now add one more rdtsc between two rdtscs', run, i is 160. so the excuting time of rdtsc on my computer is 80.

Who can tell me how to test the time of instruction "mov ebx,eax", why does rdtsc spend such long time. and the precision of rdtsc.  I couldn't find anyting of that in  IA-32 manual.

Thank you very much.

 
 03-11-2008, 12:13 PM 30250626 in reply to 30250597  

Re: Excuting time of the instruction "rdtsc" on X86

Are you attempting rdtsc in virtualized mode?  If so, what VMM are you using?  Also, what is the physical CPU you are using (speed and type)?

Stev
 
 03-12-2008, 6:55 AM 30250681 in reply to 30250626  

Re: Excuting time of the instruction "rdtsc" on X86

No VM, rdtsc running on the real machine. CPU is  Pentieum 4 without HT and VT, 1.7 GHz.

 
 03-12-2008, 8:28 AM 30250687 in reply to 30250681  

Re: Excuting time of the instruction "rdtsc" on X86

There's part of your answer.  rdtsc is much slower and behaves much different on early P4 than on CPUs of the last 3 years.  In any case, rdtsc can't give you precision of less than 1 FSB clock cycle.
 
 03-13-2008, 7:21 AM 30250744 in reply to 30250687  

Re: Excuting time of the instruction "rdtsc" on X86

Thank you very much. But is there any instructions which is faster than rdtsc. even RDMSR. How long will it take, Is it same as rdtsc?
 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...