At Tue, 16 Apr 2002 19:14:27 -0400,
Paul Davis wrote:
> 
> Sure (thanks to Kai for pointing out <asm/timex.h>
> 
> ----------------------------------------------------------------------
> 
> #include <asm/timex.h>
> 
>    ...
>    cycles_t cycles = get_cycles();     
>    ...
> 
> ----------------------------------------------------------------------
> 
> this will work on at least x86, ppc and alpha. 

no, please don't include asm headers.

including asm headers makes the app fairly unportable, because
- asm headers are not the part of gcc header files, so it's uncertain
  which file is used
- it depends on the kernel source version whether such a macro really
  exists.

the best way is to retrieve the corresponding macro (e.g. get_cycles)
for each architecture from asm/timex.h, and merge it into your
source (or create a local header file).


ciao,

Takashi

Reply via email to