#include
#include
int main()
{
volatile unsigned int ts,te;
volatile unsigned int sdx,edx;
unsigned __int64 clock_cycles;
unsigned int max=1<<31;
unsigned __int64 max0=(unsigned __int64 )max*2;
clock_t start,end;
start=clock();
__asm
{
rdtsc;
mov sdx,edx;
mov ts,eax;
}
Sleep(1000);
end=clock();
__asm
{
rdtsc;
mov edx,edx;
mov te,eax;
}
clock_cycles=(unsigned __int64 )(edx-sdx)*max0+te-ts;
printf("ticks=%lu\n",clock_cycles);
return 0;
}
阅读(560) | 评论(0) | 转发(0) |