From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 9 13:43:49 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3757B106566B for ; Fri, 9 Sep 2011 13:43:49 +0000 (UTC) (envelope-from ambrosehua@gmail.com) Received: from mail-gx0-f179.google.com (mail-gx0-f179.google.com [209.85.161.179]) by mx1.freebsd.org (Postfix) with ESMTP id E6A9D8FC08 for ; Fri, 9 Sep 2011 13:43:48 +0000 (UTC) Received: by gxk1 with SMTP id 1so1261750gxk.10 for ; Fri, 09 Sep 2011 06:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=if8McSCcnum/uPiV0PppMP8Mfpdydb9uHzpXQGAbbKE=; b=oZcHym22pHEF+PPO73R8u2vPkUFG918Zble/XXv1kokfiogaCz2GVq8BBh61VW0qY+ /DL1TCyiSseEiHpC8UEFNaFRTnE0Bntx+Lih2rBTxQmUnKND4Su197U6Rhlc1owEWO7n toGPvwd8j7xJhlyiCyN9kozAVNx9HVkHLeJYM= MIME-Version: 1.0 Received: by 10.42.147.194 with SMTP id o2mr656452icv.120.1315575827335; Fri, 09 Sep 2011 06:43:47 -0700 (PDT) Received: by 10.42.222.129 with HTTP; Fri, 9 Sep 2011 06:43:47 -0700 (PDT) In-Reply-To: <20110907151543.GA63310@freebsd.org> References: <20110906220115.GA25048@freebsd.org> <20110907061741.GC96277@server.vk2pj.dyndns.org> <20110907151543.GA63310@freebsd.org> Date: Fri, 9 Sep 2011 21:43:47 +0800 Message-ID: From: Paul Ambrose To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: excessive use of gettimeofday(2) and other syscalls X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2011 13:43:49 -0000 what version of chromium are you using? I use chromium-13.0.782.215 on amd64 8.2-stable, the gettimeofday call is far less than 20000 per second, about 20 per second, but I notice old version has this bug, but latest version has fixed it. Maybe you should update your chromium and try again. Firefox 5 and 6 has more gettimeofday call than 20000 per second on my amd64-8.2-stable box. 2011/9/7 Alexander Best > On Wed Sep 7 11, Peter Jeremy wrote: > > On 2011-Sep-06 16:44:48 -0600, Manish Vachharajani < > manishv@lineratesystems.com> wrote: > > >Under 7.3 (haven't checked 8 or 9) this issue crops up because the > > >time system call calls gettimeofday under the hood (see > > >lib/libc/gen/time.c). As a result, the kernel tries to get an > > >accurate subsecond resolution time that simply gets chopped to the > > >nearest second. > > > > Under 8.x and later, time(3) uses clock_gettime(CLOCK_SECOND,...) > > rather than gettimeofday(). This is intended to be much cheaper > > than gettimeofday(). > > > > On 2011-Sep-06 21:15:55 -0400, Rayson Ho wrote: > > >IMO, the time returned by gettimeofday does not need to be high > > >precision. There are higher resolution time APIs on Linux and I > > >believe the application programmers know when to use the slower but > > >more accurate clock API. > > > > There are 3 standard APIs for returning time of day: > > time(3) provides second precision > > gettimeofday(2) provides microsecond precision > > clock_gettime(2) provides nanosecond precision > > > > By default, FreeBSD attempts to provide resolution as close as > > possible to the precision - which makes the 2 system calls fairly > > expensive. In order to reduce the cost where the resolution isn't > > important, FreeBSD provides several non-standard clock types for > > clock_gettime(2). This approach differs from Linux - and it seems > > that there is a non-trivial body of code that assumes that calling > > gettimeofday() is very cheap. > > > > There is probably a good case for an API that provides a resolution > > of the order of a tick but there is no standard for this. > > chromium is triggering ~20.000 gettimeofday(2) calls per second on my > machine. > i'm running CURRENT on amd64. > > cheers. > alex > > > > > -- > > Peter Jeremy > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >