Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Sep 2011 16:44:48 -0600
From:      Manish Vachharajani <manishv@lineratesystems.com>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: excessive use of gettimeofday(2) and other syscalls
Message-ID:  <CAHRgBhRe8n%2BV3nSzRn4_fctHB1nie2ACk7oRVOPJqqKaMUgKrg@mail.gmail.com>
In-Reply-To: <20110906220115.GA25048@freebsd.org>
References:  <20110906220115.GA25048@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.  Lots of libraries assume that time is fast because it
is fast under Linux.  Every instance where I have seen this as a
performance issue, the call has been to time not a direct call to
gettimeofday.  The latest openssl (not the one from FreeBSD, but the
one from openssl.org has this issue for example.

Manish

On Tue, Sep 6, 2011 at 4:01 PM, Alexander Best <arundel@freebsd.org> wrote:
> hi there,
>
> in a recent discussion on current@ [1], it was discovered that chromium makes
> excessive use of gettimeofday(2). while searching google, i found other
> software that is/was having the same issue [2]. although this is a programming
> error, it would still be nice, if freebsd could issue a warning in cases like
> these. would it be possible to instruct freebsd to issue a warning, when a
> process issues a certain amount of syscalls per second (maybe tuneable via
> sysctl)?
>
> while calling gettimeofday(2) excessively isn't causing any harm, it triggers
> a lot of context switches and reduces performance. having such warnings in
> place could help a user identify such a process without having to use debugging
> tools, such as ktrace or dtrace.
>
> cheers.
> alex
>
> [1] http://www.mail-archive.com/freebsd-current@freebsd.org/msg131040.html
> [1] https://forum.transmissionbt.com/viewtopic.php?f=2&t=11687
> _______________________________________________
> 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"
>



-- 
Manish Vachharajani
Founder
LineRate Systems
manishv@lineratesystems.com
(609)635-9531 M



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHRgBhRe8n%2BV3nSzRn4_fctHB1nie2ACk7oRVOPJqqKaMUgKrg>