Reading timestamp counter (IA-32/64)


Greg,

Here's one way to read the IA-32/IA-64 time stamp counters (#define
IA32 or IA64 and compile with gcc).  val should contain the
current value and you can adjust according to the clock speed.

Rick

---------------------------------------------------------------

  unsigned long long val;

#if defined(IA64)

  __asm__ __volatile__("mov %0=ar.itc" : "=r"(val) :: "memory");

#elif defined(IA32)

  __asm__ __volatile__("rdtsc" : "=A" (val) : );

#endif



Other Mailing lists | Author Index | Date Index | Subject Index | Thread Index