Re: Getting Time Difference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 21, 2003 at 07:48:57AM +0200, Gilad Benjamini wrote:
> > In mvsita kernel we introduced an abstraction layer which consists
> > of the following:
> > 
> > readclock_init()
> > readclock()
> > clock_to_usecs()
> > 
> > For MIPS in general, we use the following implementation:
> > 
> > #define readclock_init()
> > #define readclock(low)   do {                           \
> >         db_assert(mips_cpu.options & MIPS_CPU_COUNTER); \
> >         low = read_32bit_cp0_register(CP0_COUNT);       \
> >         } while (0)     
> > #define clock_to_usecs(clocks) ((clocks) / 
> > ((mips_counter_frequency / 1000000)))
> > 
> 
> Thx.
> How would I go about doing readclock to a 64 bit variable ?
> The 32 bit can wrap around pretty fast in today's processors.
>

This interface is meant for short and precise kernel timing
measurement.  Wraping around once does not cause problem as
long as the elapsed clock cycles is less than 2^32.  That gives 
you about 40 secs max interval on a CPU with 100MHz counter
frequency.

Jun


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux