Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2001 07:33:08 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Matt Dillon <dillon@earth.backplane.com>, dave <dleimbac@earthlink.net>, freebsd-questions@FreeBSD.ORG, arch@FreeBSD.ORG
Subject:   Re: Gettimeofday Again...
Message-ID:  <Pine.SUN.3.91.1010515071603.2820A-100000@pcnet1.pcnet.com>
In-Reply-To: <3B00EF40.A1232B75@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 May 2001, Terry Lambert wrote:
> Matt Dillon wrote:
> > :Well I have been on the IRC in and out of mail list archives
> > :and cannot geta good answer to this question...
> > :
> > :Why does gettimeofday perform so poorly on FreeBSD vs the
> > :same hardware on Linux 2.4.2?
> > 
> >     Why should it matter?  gettimeofday() is not something
> >     that is typically called in a tight loop, it would be
> >     silly to optimize it.  17uS is plenty fast enough.
> > 
> >     Systems rarely have performance problems due to syscall
> >     overhead.
> 
> I think that perhaps you aren't doing high performance
> server work, if you really think 17uS is "plenty fast enough".
> 
> I have an application where gettimeofday() was a significant
> fraction of the overhead; it was being used to provide for
> marketing eye-candy... basically, squid-compatible proxy
> logging that could be processed using common eye-candy tools
> normally used against squid logs for transaction in, time
> sent to back end, time data came from back end, and time data
> sent to client.

The threads library was also changed to avoid gettimeofday()
to avoid the overhead of an extra system call during a thread
context switch.  It needs the current time to wakeup waiting
threads.  We switched to a fixed interval timer and only called
gettimeofday when the timer went off, but it was necessary to
add a couple of hacks because it introduced a couple of other
problems.

I'd really like an mmap'able gettimeofday/clock_gettime
thingie, or some counter whose rate I know.

-- 
Dan Eischen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.91.1010515071603.2820A-100000>