Re: do_gettimeofday( ) precision?

From: abhijit
Date: Thu Jun 24 2004 - 02:01:20 EST


On Thu, 24 Jun 2004 12:13:11 +0530, abhijit <slashdev@xxxxxxxxx> wrote:
>
> basically i want some counter w/ microsend resolution that fits into 32 bits.
> couple of possible solutions come to my mind:
>
> [1] use TSC and convert it to microsec
> [2] use get_timeofday( ) and convert to microsec
> [3] use xtime variable directly and convert to microsec
> (any other ways?)
>
> conversion in [1] will be costly (a div involved).
> conversion in [2]/[3] can be done using bit operators. (usec|sec << 20)
> but [2] will incur function call overhead which i'd like to avoid.
>
> so is using xtime directly ok and reliable?

ok. after reading up the source, i think xtime isn;t updated frequently and will
not have the required resolution :( so calling do_gettimeofday() seems the only
way out (unless somebody has any other idea).

btw why isn't do_gettimeofday( ) declared as "inline". so its bit
cheaper to call
especially where you are timestamping (say packets) often.

thanks
abhijit
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/