From owner-freebsd-performance@FreeBSD.ORG Mon Apr 27 00:02:49 2009 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BD6D106564A; Mon, 27 Apr 2009 00:02:49 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from smtp.utwente.nl (smtp2.utsp.utwente.nl [130.89.2.9]) by mx1.freebsd.org (Postfix) with ESMTP id CE43D8FC15; Mon, 27 Apr 2009 00:02:48 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from nox.student.utwente.nl (nox.student.utwente.nl [130.89.165.91]) by smtp.utwente.nl (8.12.10/SuSE Linux 0.7) with ESMTP id n3QNoWMA027686; Mon, 27 Apr 2009 01:50:32 +0200 From: Pieter de Goeje To: freebsd-hackers@freebsd.org Date: Mon, 27 Apr 2009 01:50:31 +0200 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904270150.31912.pieter@degoeje.nl> X-UTwente-MailScanner-Information: Scanned by MailScanner. Contact servicedesk@icts.utwente.nl for more information. X-UTwente-MailScanner: Found to be clean X-UTwente-MailScanner-From: pieter@degoeje.nl X-Spam-Status: No Cc: freebsd-performance@freebsd.org Subject: ACPI-fast default timecounter, but HPET 83% faster X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 00:02:49 -0000 Dear hackers, While fiddling with the sysctl kern.timecounter.hardware, I found out that on my system HPET is significantly faster than ACPI-fast. Using the program below I measured the number of clock_gettime() calls the system can execute per second. I ran the program 10 times for each configuration and here are the results: x ACPI-fast + HPET +-------------------------------------------------------------------------+ |x +| |x +| |x ++| |x ++| |x ++| |x ++| |A |A| +-------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 10 822032 823752 823551 823397.8 509.43254 + 10 1498348 1506862 1502830 1503267.4 2842.9779 Difference at 95.0% confidence 679870 +/- 1918.94 82.5688% +/- 0.233052% (Student's t, pooled s = 2042.31) System details: Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz (3200.02-MHz 686-class CPU), Gigabyte P35-DS3R motherboard running i386 -CURRENT updated today. Unfortunately I only have one system with a HPET timecounter, so I cannot verify these results on another system. If similar results are obtained on other machines, I think the HPET timecounter quality needs to be increased beyond that of ACPI-fast. Regards, Pieter de Goeje ----- 8< ----- clock_gettime.c ----- 8< ------ #include #include #include #define COUNT 1000000 int main() { struct timespec ts_start, ts_stop, ts_read; double time; int i; clock_gettime(CLOCK_MONOTONIC, &ts_start); for(i = 0; i < COUNT; i++) { clock_gettime(CLOCK_MONOTONIC, &ts_read); } clock_gettime(CLOCK_MONOTONIC, &ts_stop); time = (ts_stop.tv_sec - ts_start.tv_sec) + (ts_stop.tv_nsec - ts_start.tv_nsec) * 1E-9; printf("%.0f\n", COUNT / time); }