Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2012 09:57:01 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@freebsd.org>
Subject:   Re: svn commit: r237434 - in head/lib/libc: amd64/sys gen i386/sys include sys
Message-ID:  <201206220957.01341.jhb@freebsd.org>
In-Reply-To: <20120622073455.GE69382@alchemy.franken.de>
References:  <201206220713.q5M7DVH0063098@svn.freebsd.org> <20120622073455.GE69382@alchemy.franken.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, June 22, 2012 3:34:56 am Marius Strobl wrote:
> On Fri, Jun 22, 2012 at 07:13:31AM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Fri Jun 22 07:13:30 2012
> > New Revision: 237434
> > URL: http://svn.freebsd.org/changeset/base/237434
> > 
> > Log:
> >   Use struct vdso_timehands data to implement fast gettimeofday(2) and
> >   clock_gettime(2) functions if supported. The speedup seen in
> >   microbenchmarks is in range 4x-7x depending on the hardware.
> >   
> >   Only amd64 and i386 architectures are supported. Libc uses rdtsc and
> >   kernel data to calculate current time, if enabled by kernel.
> 
> I don't know much about x86 CPUs but is my understanding correct
> that TSCs are not synchronized in any way across CPUs, i.e.
> reading it on different CPUs may result in time going backwards
> etc., which is okay for this application though?

Hmm, in practice I have found that on modern x86 CPUs (Penryn and later) the 
TSC is in fact sychronized across packages at work.  At least, when I measure 
skew across packages it appears to be consistent with the time it would take a 
write to propagate from one to the other.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206220957.01341.jhb>