I use this macro to compute the time. I have a pentium pro 200, so I do
a multiply by 5 to get the time in milliseconds from the ticks returned by
rdtsc. So its a lil more expensive than doing a simple rdtsc. The cpuid
call is to flush the pipeline before rdtsc, to serialize.

#define CPUCLK_PERIOD 5
#define __NAME_STRING(x) #x
#define NAME_STRING(x) __NAME_STRING(x)

#define rt_get_nstime(llptr)  \
__asm__ __volatile__ (  \
          "xor %%eax, %%eax\n\t" \
          "cpuid \n\t" \
          "rdtsc \n\t" \
          "movl %%eax, %%ebx \n\t"\
          "movl %%edx, %%eax \n\t"\
          "movl $"NAME_STRING(CPUCLK_PERIOD)", %%ecx \n\t"\
          "mull %%ecx \n\t"\
          "movl %%eax,%%edx \n\t"\
          "movl %%ebx,%%eax \n\t" \
          "movl %%edx,%%ebx \n\t" \
          "mull %%ecx \n\t"\
          "addl %%ebx,%%edx \n\t"\
          : "=A" (llptr) \
          : : "eax","ebx","ecx","edx","memory")

==============================================================================
                                     _|_
  MANOJ APTE              -----------(o)-----------   500 Louisville St, #59
  High Performance Computing Lab                      Starkville, MS 39759
  phone: (601) 325 7503                               phone:  (601) 323 8160
                         
  Engineering Research Center.              email: [EMAIL PROTECTED]
  phone: (601) 325 2476                     http://www.erc.msstate.edu/~manoj
==============================================================================



--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to