From owner-freebsd-current@FreeBSD.ORG Fri Oct 28 08:14:36 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05AAE16A41F for ; Fri, 28 Oct 2005 08:14:36 +0000 (GMT) (envelope-from boynagar@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id C0A7743D69 for ; Fri, 28 Oct 2005 08:14:28 +0000 (GMT) (envelope-from boynagar@gmail.com) Received: by xproxy.gmail.com with SMTP id s9so259571wxc for ; Fri, 28 Oct 2005 01:14:27 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=KY0DUFX6G0qqASUh6sIjGzMu2WkwEiHjovby0+IZ1RrSDIPb8VUH/VjmgpQLOcP/5wSlmNgFOIYXKF1CtfB37mYg/AqVfw7VgpAnwosnKycaVuB+qKnQmDipCZ6NbXDo/FegNx3dN4AAPFM3dKuFib5phu76iMZ2jB+mL0WU8PI= Received: by 10.64.251.6 with SMTP id y6mr6596qbh; Fri, 28 Oct 2005 01:14:27 -0700 (PDT) Received: by 10.64.193.15 with HTTP; Fri, 28 Oct 2005 01:14:27 -0700 (PDT) Message-ID: Date: Fri, 28 Oct 2005 13:14:27 +0500 From: Katu To: current@freebsd.org In-Reply-To: <43613541.7030009@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <21137.1130401220@critter.freebsd.dk> <00a801c5dacf$db3b7700$6504010a@Jura> <43613541.7030009@mac.com> Cc: Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2005 08:14:36 -0000 On 10/28/05, Chuck Swiger wrote: > Yuriy N. Shkandybin wrote: > >>> Check gettimeofday syscall, it follows every I/O syscall, I think > >>> our gettimeofday is tooooooo expensive, if we can directly get time f= rom > >>> memory, the performance will be improved further. > > > > It's true: > > run next on same PC -- freebsd and linux and compare > [ ...snippet of timing code deleted, see attachment instead... :-) ] > > FreeBSD 4.11-STABLE i386 > null function: 0.01069 > getpid(): 0.51729 > time(): 3.51727 > gettimeofday(): 3.48715 > > FreeBSD 5.4-STABLE i386 > null function: 0.01278 > getpid(): 0.51329 > time(): 2.54771 > gettimeofday(): 2.54982 > > Linux 2.6.5 i686 > null function: 0.01858 > getpid(): 0.01979 > time(): 0.44811 > gettimeofday(): 0.55776 > > Darwin 8.2.0 Power Macintosh > null function: 0.01889 > getpid(): 0.03590 > time(): 0.20913 > gettimeofday(): 0.17278 > > SunOS 5.8 sun4u > null function: 0.05051 > getpid(): 1.29846 > time(): 1.26596 > gettimeofday(): 0.29507 > > [ These are representative results (in seconds); running the test three t= imes > per host shows the null function time value is stable to two digits, or t= hree > on some hosts; the other values seem to vary by less than 10%. ] > > The Intel boxes are all Intel P3, between 700MHz and 1Ghz, the Sun is a > dual-proc E450 @ 450MHz, and the other is a Mac Mini @ 1.3Ghz, I think. > > Real numbers are are well and good, but I don't want to start yet another > thread about microbenchmarks or statistics. Dual CPU Pentium II 300 MHz running FreeBSD 6.0-RC-1, almost GENERIC kernel= : null function: 0.00686 getpid(): 1.72151 time(): 4.57979 gettimeofday(): 4.45133 Same machine under Gentoo Linux (kernel 2.6.10): null function: 0.00678 getpid(): 0.04737 time(): 1.09754 gettimeofday(): 1.36030