Re: [PATCH] Prepend timestamp in msgbuf

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Mon, 17 Oct 2011 17:24:42 -0700
On Mon, Oct 17, 2011 at 5:18 PM, Arnaud Lacombe <lacombar_at_gmail.com> wrote:
> Hi,
>
> On Mon, Oct 17, 2011 at 6:22 PM, Ed Schouten <ed_at_80386.nl> wrote:
>> Ah, missed something.
>>
>>> +             getnanouptime(&ts);
>>> +             err = snprintf(buf, sizeof buf, "[%zd.%.6ld] ",
>>> +                 ts.tv_sec, ts.tv_nsec / 1000);
>>
>> It seems we also have a getmicrouptime(), which returns a struct
>> timeval.
> fixed.
>
>> Also a more general question: is it actually safe to call
>> getnanouptime() here? This code gets executed from an arbitrary context,
>> right?
>>
> right, but getmicrouptime() is not doing much magic. Just reading a
> cached value, do an arithmetic conversion. I do not really see any
> unsafe part.

Based on glancing around other areas of the kernel, I'd assume that
using this KPI as-is is fine because I don't see any locking employed
elsewhere...
-Garrett
Received on Mon Oct 17 2011 - 22:24:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:19 UTC