- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I made an experiment on testing one "mov to/from registers" instructions, key souce code listsbelow:
int i;
_asm{
rdtsc;
movebx,eax;
rdtsc;
subeax,ebx;
movi,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.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No VM, rdtsc running on the real machine. CPU is Pentieum 4 without HT and VT, 1.7 GHz.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page