Re: [Patch 1/4] Delay accounting: Initialization

Shailabh Nagar
2005-11-15T15:15:48Z

Marcelo Tosatti wrote:
> On Mon, Nov 14, 2005 at 08:20:17PM -0800, Andrew Morton wrote:
>
>>Shailabh Nagar <nagar@watson.ibm.com> wrote:
>>
>>>+ *ts = sched_clock();
>>
>>I'm not sure that it's kosher to use sched_clock() for fine-grained
>>timestamping like this. Ingo had issues with it last time this happened?
>
>
> If the system boots with use_rtc == 0 you're going to get jiffies based
> resolution from sched_clock(). I have a 1GHz Pentium 3 around here which
> does that.

Good point, thanks. This reemphasizes the need for better normalization
at output time.

> Maybe use do_gettimeofday() for such systems?

Perhaps getnstimeofday() so resolution isn't reduced to msec level unnecessarily.
In these patches, userspace takes responsibility for handling wraparound so
delivering a reasonably high-resolution delay data from the kernel is preferable.

>
> Would be nice to have a sort of per-arch overridable "gettime()" function?
>

Provided as part of this patch ?

>><too lazy to read all the code> Do you normalise these numbers in some
>>manner before presenting them to userspace? If so, by what means?