From owner-freebsd-arch Mon May 14 20:37:15 2001 Delivered-To: freebsd-arch@freebsd.org Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.121.85]) by hub.freebsd.org (Postfix) with ESMTP id 5CE2437B423; Mon, 14 May 2001 20:37:11 -0700 (PDT) (envelope-from dleimbac@earthlink.net) Received: from 1Cust79.tnt1.starkville.ms.da.uu.net (1Cust79.tnt1.starkville.ms.da.uu.net [63.30.107.79]) by gull.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id UAA19677; Mon, 14 May 2001 20:37:07 -0700 (PDT) Message-Id: <200105150337.UAA19677@gull.mail.pas.earthlink.net> Date: Mon, 14 May 2001 22:39:32 CDT From: dave To: freebsd-questions@freebsd.org, arch@freebsd.org Subject: Gettimeofday Again... Reply-To: dleimbac@earthlink.net X-Mailer: Spruce 0.6.5 for X11 w/smtpio 0.7.9 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Well I have been on the IRC in and out of mail list archives and cannot get a good answer to this question... Why does gettimeofday perform so poorly on FreeBSD vs the same hardware on Linux 2.4.2? ---SNIP----- #include #include int main() { struct timeval tv1, tv2, tv3; gettimeofday(&tv1, 0); gettimeofday(&tv2, 0); gettimeofday(&tv3, 0); printf("Time 1 %d:%d\n", tv1.tv_sec, tv1.tv_usec); printf("Time 2 %d:%d\n", tv3.tv_sec, tv3.tv_usec); } ----SNIP----- I get anywhere from 14usec to 17usec just for the call to gettimeofday. On the 2.4.2 linux kernel its something like 3usec. I just want to know why we are so much slower. I have heard the "caching" argument and it doesn't float very well since all I can find is CPU based L1 cache which should also apply to FreeBSD. That's principle of locality stuff and more on the hardware side. Since I am running on identical hardware I don't see how this is possible except for a potential problem/lack of optimization in FreeBSD. Don't get me wrong... I love FreeBSD... and it generally outperforms linux everywhere I use it. I just don't understand this huge gap in performance. Concerned.... Dave Leimbach To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message