From owner-freebsd-stable@FreeBSD.ORG Tue Mar 8 14:40:07 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C68916A4CE for ; Tue, 8 Mar 2005 14:40:07 +0000 (GMT) Received: from mail.ticketswitch.com (mail.ticketswitch.com [194.200.93.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id B731043D48 for ; Tue, 8 Mar 2005 14:40:06 +0000 (GMT) (envelope-from petefrench@ticketswitch.com) Received: from [172.16.1.6] (helo=dilbert.firstcallgroup.co.uk) by mail.ticketswitch.com with esmtp (Exim 4.43 (FreeBSD)) id 1D8fsS-000Di4-Iy for stable@FreeBSD.ORG; Tue, 08 Mar 2005 14:40:04 +0000 Received: from petefrench by dilbert.firstcallgroup.co.uk with local (Exim 4.43 (FreeBSD)) id 1D8fsS-000KoN-Gj for stable@FreeBSD.ORG; Tue, 08 Mar 2005 14:40:04 +0000 To: stable@FreeBSD.ORG Message-Id: From: Pete French Date: Tue, 08 Mar 2005 14:40:04 +0000 Subject: Just a sanity check before I sumbit a buig report X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2005 14:40:07 -0000 The man page for getrusage says that the frequency of the statistics clock is given by sysconf(_SC_CLK_TCK). The source code to /usr/bin/time uses a function 'getstathz' to get the frequency of the statistics clock which is does using sysctl and KERN_CLOCKRATE On my system the first returns 100Hz and the second 128Hz!!! Now, is this: 1) A bug in /usr/bin/time 2) A bug in sysconf(_SC_CLK_TCK) 3) A bug in the manpage for getrusage 4) A bug in the kernel and the values should not be different 5) A bug in my understanding! Note that although option '4' is unlikely, if I run the test a.out file on other FreeBSD systems I get 128 for both values, which is even odder! -pcf. Test code (will probably give 128 for both on your system) #include #include #include #include #include #include static int getstathz() { struct clockinfo clockrate; int mib[2]; size_t size; mib[0] = CTL_KERN; mib[1] = KERN_CLOCKRATE; size = sizeof clockrate; if (sysctl(mib, 2, &clockrate, &size, NULL, 0) == -1) err(1, "sysctl kern.clockrate"); return clockrate.stathz; } int main() { printf("get stat hz = %d\n", getstathz()); printf("sysconf clock tick = %ld\n", sysconf(_SC_CLK_TCK)); return 0; }