Date: Tue, 3 Jun 2008 19:31:50 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Sean Chittenden <sean@chittenden.org> Cc: freebsd-performance@FreeBSD.org, Bruce Evans <brde@optusnet.com.au>, Claus Guttesen <kometen@gmail.com> Subject: Re: Micro-benchmark for various time syscalls... Message-ID: <20080603192056.B6242@delplex.bde.org> In-Reply-To: <CB079FCA-DE69-4A00-9B52-7A069A91DE47@chittenden.org> References: <2B465A44-2578-4675-AA17-EBE17A072017@chittenden.org> <b41c75520806020101o606d13ffqc5d599ee70a10ff9@mail.gmail.com> <20080602205953.X3162@delplex.bde.org> <CB079FCA-DE69-4A00-9B52-7A069A91DE47@chittenden.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2 Jun 2008, Sean Chittenden wrote: >>> rozetta~/devel/c%>sysctl hw.model >>> hw.model: Intel(R) Xeon(R) CPU E5345 @ 2.33GHz >>> >>> rozetta~/devel/c%>./bench_time 9079882 | sort -rnk1 >>> Timing micro-benchmark. 9079882 syscall iterations. >>> Avg. us/call Elapsed Name >>> 1.405469 12.761494 clock_gettime(2/CLOCK_REALTIME) >>> ... >> >> These seem about right for a normal untuned ~2GHz system: > > This begs the question, tuning for time calls. Do you have a best practice > that you use for reducing the cost of time calls? -sc At least try all possible time counters, and choose the one that works best. Best == fastest and accurate enough. Best != highest quality according to kernel hard-coded quality numbers. ntp will tell you if it isn't accurate enough if this isn't obvious. This normally means the TSC on UP systems without power management and ACPI-fast otherwise. The kernel quality parameter gives too much preference to ACPI-fast. Switching between all possible timecounters at runtime is easier in not very old versions of FreeBSD. Old versions didn't even list all timecounters considered at boot time. Some timecounters, e.g., HPET and of course ACPI* on non-ACPI systems are not available even if the hardware supports them unless they are configured at compile time or boot time. It's hard to test the HPET counter on new FreeBSD cluster machines because it is not confiugured and it would require privilege to use if it were configured but not selected. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080603192056.B6242>