Re: [Patch 3/6] statistics infrastructure - prerequisite: timestamp
From: Andrew Morton
Date: Wed May 24 2006 - 18:05:07 EST
Martin Peschke <mp3@xxxxxxxxxx> wrote:
>
> +static inline int nsec_to_timestamp(char *s, unsigned long long t)
> +{
> + unsigned long nsec_rem = do_div(t, NSEC_PER_SEC);
> + return sprintf(s, "[%5lu.%06lu]", (unsigned long)t,
> + nsec_rem/NSEC_PER_USEC);
> +}
do_div() is actually defined in terms of u64, not unsigned long long.
Although afaict this will all work OK and all the usual type promotions
will dtrt.
Which begs the question: how _does_ the kernel represent nanoseconds? The
time-management code is a bit undecided (search for long long in
posix-cpu-timers.c, and for u64 in hrtimers.c). All a bit confused.
Anwyay. This function is too big and slow to be inlined..
-
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/