Chinaunix首页 | 论坛 | 博客
  • 博客访问: 392392
  • 博文数量: 103
  • 博客积分: 3073
  • 博客等级: 中校
  • 技术积分: 1078
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-23 15:04
文章分类

全部博文(103)

文章存档

2012年(13)

2011年(76)

2010年(14)

分类: C/C++

2011-06-15 11:05:37

#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;

}
阅读(523) | 评论(0) | 转发(0) |
0

上一篇:gcc 常见错误

下一篇:iaca 的一些参数

给主人留下些什么吧!~~