帮忙解释一下这段程序
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,3)extern unsigned long cpu_khz;
// Setup function to read cpu cycles out of pentium class processor.
#define rdtsc2(low,high) \
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
#else
………………
#endif 调用是这样的
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,3)
double cycles_d, khz_d;
unsigned long eax, edx;
rdtsc2(eax,edx);
cycles_d = (edx*4294967296.0)+eax;
khz_d = (double) cpu_khz;
return cycles_d/(khz_d*1.0e3); search rdtsc()in google.
there is a good introduction on rdtsc on intel site.
页:
[1]