#define rdtscll(val) \
__asm__ __volatile__ ("rdtsc" : "=A" (val))

example

#include<stdio.h>
int i;
unsigned long e;
#define as(p) \
__asm__ __volatile__ (p)
#define rdtscll() \
as("rdtsc")
int main(void)
{
	rdtscll();
	as("movl %eax,%ecx");
	rdtscll();
	as("subl %ecx,%eax");
	as("movl %eax,e");
	printf("duration:%lld\n", e);
	return 0;
}

  

相关文章:

  • 2022-01-03
  • 2021-08-20
  • 2021-09-13
  • 2021-12-08
  • 2022-01-19
  • 2021-10-26
  • 2021-07-19
猜你喜欢
  • 2021-12-30
  • 2022-12-23
  • 2022-01-28
  • 2022-01-24
  • 2021-10-16
相关资源
相似解决方案