From: Matt Helsley <matthltc@us.ibm.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, john stultz <johnstul@us.ibm.com>,
Jean-Pierre Dion <jean-pierre.dion@bull.net>,
Guillaume Thouvenin <guillaume.thouvenin@bull.net>,
Badari Pulavarty <pbadari@us.ibm.com>,
Ram Pai <linuxram@us.ibm.com>,
CKRM-Tech <ckrm-tech@lists.sourceforge.net>,
Erich Focht <efocht@hpce.nec.com>,
elsa-devel <elsa-devel@lists.sourceforge.net>,
ay Lan <jlan@engr.sgi.com>, Erik Jacobson <erikj@sgi.com>,
Jack Steiner <steiner@sgi.com>
Subject: Re: [ckrm-tech] [RFC][PATCH] Add timestamp to process event connector message
Date: Mon, 05 Dec 2005 20:35:45 -0800 [thread overview]
Message-ID: <1133843745.25202.1360.camel@stark> (raw)
In-Reply-To: <1133836764.6296.1.camel@localhost>
On Mon, 2005-12-05 at 18:39 -0800, Dave Hansen wrote:
> On Mon, 2005-12-05 at 18:21 -0800, Matt Helsley wrote:
> > +static inline void get_timestamp(struct timespec *ts)
> > +{
> > + unsigned int seq;
> > + struct timespec wall2mono;
> > +
> > + /* synchronize with settimeofday() changes */
> > + do {
> > + seq = read_seqbegin(&xtime_lock);
> > + getnstimeofday(ts);
> > + wall2mono = wall_to_monotonic;
> > + } while(read_seqretry(&xtime_lock, seq));
> > +
> > + /* adjust to monotonicaly-increasing values */
> > + ts += wall2mono.tv_sec;
> > + ts += wall2mono.tv_nsec;
> > + while ((ts->tv_nsec - NSEC_PER_SEC) >= 0) {
> > + ts->tv_nsec -= NSEC_PER_SEC;
> > + ts->tv_sec++;
> > + }
> > +}
>
> This seems like something a bit too generic to have in your
> drivers/connector/cn_proc.c file. Is there a generic timekeeping
> function that should be used instead? Or, should this go into one of
> the timekeeping files?
>
> -- Dave
An excellent point!
There are two functions that might seem appropriate for a timestamp:
current_kernel_time()
do_gettimeofday()
The former has jiffies resolution and hence may not be sufficient to
distinguish ordering between two events in the same process. The second
is interpolated wall time and may not necessarily monotonic.
Most other methods, such as get_cycles(), reading the tsc, etc. are not
SMP-safe or do not provide the needed resolution. Hence the patch gets
the time in nanoseconds and converts to a monotonicly increasing value.
I'll split out a similarly-named function (get_timestamp exists in
ibmasm.c) to kernel/time.c and repost as two patches.
Thanks,
-Matt Helsley
prev parent reply other threads:[~2005-12-06 4:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-06 2:21 [RFC][PATCH] Add timestamp to process event connector message Matt Helsley
2005-12-06 2:39 ` [ckrm-tech] " Dave Hansen
2005-12-06 4:35 ` Matt Helsley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1133843745.25202.1360.camel@stark \
--to=matthltc@us.ibm.com \
--cc=akpm@osdl.org \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=efocht@hpce.nec.com \
--cc=elsa-devel@lists.sourceforge.net \
--cc=erikj@sgi.com \
--cc=guillaume.thouvenin@bull.net \
--cc=haveblue@us.ibm.com \
--cc=jean-pierre.dion@bull.net \
--cc=jlan@engr.sgi.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=pbadari@us.ibm.com \
--cc=steiner@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox