Date: Sun, 3 Feb 2002 14:57:31 -0800 (PST) From: Jason Carroll <jason@carrollgroup.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/34596: slow gettimeofday in FreeBSD 4.5 Message-ID: <200202032257.g13MvVa66671@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 34596
>Category: misc
>Synopsis: slow gettimeofday in FreeBSD 4.5
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Feb 03 15:00:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Jason Carroll
>Release: FreeBSD 4.5
>Organization:
>Environment:
FreeBSD galois 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Sat Feb 2 16:28:26 EST 2002 jason@galois:/usr/obj/usr/src/sys/LOCAL i386
(I also tried this with the GENERIC kernel that came with the 4.5 release)
>Description:
gettimeofday() seems to be slower (by about 5 times) than it was under FreeBSD 4.2. I ran the program below on an Intel 1.9ghz machine with 4.5 FreeBSD installed (with the GENERIC kernel), and it took approximately 5 seconds, or 5ms per call to gettimeofday. I then boot the same machine with a 4.2 kernel and the same program ran in under 1 second. See the next window for the program source.
Any ideas? This doesn't seem like a critical problem, but I thought it should be mentioned.
Thanks
>How-To-Repeat:
#include <sys/time.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
timeval tv, st, en;
gettimeofday(&st, NULL);
for (int i = 0; i < 1000000; i++) {
gettimeofday(&tv, NULL);
}
gettimeofday(&en, NULL);
printf("delta: %ds %dus\n", en.tv_sec- st.tv_sec, en.tv_usec - st.tv_usec);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202032257.g13MvVa66671>
