[Click] click_get_cycles() on x86_64

Eddie Kohler kohler at cs.ucla.edu
Tue Jul 24 16:16:42 EDT 2007


Hi Salman,

The Linux headers say the equivalent of

"rdtsc" : "=d" (xhi), "=a" (xlo)

but that should be the same as "=A".  If that code works for you, it 
works!  I'm checking a variant of it in.

Eddie




Salman Abdul Baset wrote:
> In function click_get_cycles() defined in include/click/glue.hh, there is 
> no #ifdef for x86_64. Consequently, on the machine I am testing (quad 
> core, x86_64) click_get_cycles() returns zero.
> 
> I copied the code from
> #if CLICK_LINUXMODULE && HAVE_INT64_TYPES && __i386__
> to fix it:
> 
> <code>
> #elif CLICK_LINUXMODULE && HAVE_INT64_TYPES && __x86_64__
>      uint64_t x;
>      __asm__ __volatile__ ("rdtsc" : "=A" (x));
>      return x;
> </code>
> 
> Is this a correct way to do this?
> 
> Thanks
> Salman
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list