[TEST/REVIEW] cpu time accounting patch, step 2

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Thu, 09 Feb 2006 22:32:18 +0000
	http://phk.freebsd.dk/patch/cputime.patch 

This patch enables the new cpu time accounting method for i386 with
TSC, all amd64 and sparc64 (?) and i386 with Geode cpu.

The overall objective is to trade a minor amount of precision in
cpu time accounting for a significant speedup in context switch.

On my amd64 machine, I get 27+/-5 % improvement on unixbench/context1.

Basically the patch uses the TSC or other (per-CPU) hardware device
to keep track of CPU utilization and only converts to microseconds
when necessary.  If no "special" hardware is available the code
falls back to the timecounter hardware, whatever it is.

If the "special hardware" counter is marked as variable, a function
runs every 16 seconds and (tries to) calibrate the max frequency
we have ever seen.  (If you boot verbose it will say what it does).
This code is supposed to cope with laptops and other power-managed
hardware.  Only the "boot CPU" is calibrated, the other CPUs are
supposed to run at the same rate (but they may have an offset).

Tests, reviews etc please.

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Thu Feb 09 2006 - 21:32:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC