标签:
#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; }
标签:
原文地址:http://www.cnblogs.com/tmzbot/p/4197950.html