From owner-freebsd-arch Tue May 15 4:33:50 2001 Delivered-To: freebsd-arch@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 0BA8737B423; Tue, 15 May 2001 04:33:46 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id HAA05286; Tue, 15 May 2001 07:33:09 -0400 (EDT) Date: Tue, 15 May 2001 07:33:08 -0400 (EDT) From: Daniel Eischen To: Terry Lambert Cc: Matt Dillon , dave , freebsd-questions@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: Gettimeofday Again... In-Reply-To: <3B00EF40.A1232B75@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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-arch" in the body of the message