Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2011 17:24:42 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Arnaud Lacombe <lacombar@gmail.com>
Cc:        Ed Schouten <ed@80386.nl>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: [PATCH] Prepend timestamp in msgbuf
Message-ID:  <CAGH67wTojGdaAyZaX%2BZp9TLnmY7ibUVUx0sW-yz2Uxt3wjAf9A@mail.gmail.com>
In-Reply-To: <CACqU3MVy1hwmz-eSiR=FTGKmzeZ6EFwudpKLYOZW1K-HdPttZg@mail.gmail.com>
References:  <1318884099-6005-1-git-send-email-lacombar@gmail.com> <20111017221933.GZ91943@hoeg.nl> <20111017222259.GA91943@hoeg.nl> <CACqU3MVy1hwmz-eSiR=FTGKmzeZ6EFwudpKLYOZW1K-HdPttZg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Oct 17, 2011 at 5:18 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Mon, Oct 17, 2011 at 6:22 PM, Ed Schouten <ed@80386.nl> wrote:
>> Ah, missed something.
>>
>>> + =A0 =A0 =A0 =A0 =A0 =A0 getnanouptime(&ts);
>>> + =A0 =A0 =A0 =A0 =A0 =A0 err =3D snprintf(buf, sizeof buf, "[%zd.%.6ld=
] ",
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wTojGdaAyZaX%2BZp9TLnmY7ibUVUx0sW-yz2Uxt3wjAf9A>