百度首页 | 百度空间
 
查看文章
 
__asm__ voatile含义
2007-11-12 14:17


在奔腾机中,如果你要延时一定数目的时钟周期,可以使用rdtsc指令,下面就是使用这个功能所需的代码:
extern __inline__ unsighed long long int rdtsc()
{
unsighed long long int x;
__asm__ voatile (".byte 0x0f,0x31":"=A"(x))
return x;
}
这样你就可以延时任意个时钟周期。

"__asm__"表示后面的代码为内嵌汇编。"__volatile__"表示编译器不要优化代码。


类别:Linux | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu