[Python-checkins] peps: PEP 418: another benchmark on FreeBSD
victor.stinner
python-checkins at python.org
Thu Apr 12 00:19:49 CEST 2012
http://hg.python.org/peps/rev/0f66f87b0f86
changeset: 4220:0f66f87b0f86
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Apr 12 00:19:16 2012 +0200
summary:
PEP 418: another benchmark on FreeBSD
Add also more info on FreeBSD timecounters
files:
pep-0418.txt | 68 +++++++++++++++++++++++++++++++++++++--
1 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -333,6 +333,33 @@
the time before and after. The benchmark was run 5 times to keep the minimum
time.
+FreeBSD 8.0 in kvm with hardware virtualization:
+
+======================== ====== ========= ======= =======
+Function TSC ACPI-Safe HPET i8254
+======================== ====== ========= ======= =======
+time() 191 ns 188 ns 189 ns 188 ns
+CLOCK_SECOND 187 ns 184 ns 187 ns 183 ns
+CLOCK_REALTIME_FAST 189 ns 180 ns 187 ns 190 ns
+CLOCK_UPTIME_FAST 191 ns 185 ns 186 ns 196 ns
+CLOCK_MONOTONIC_FAST 188 ns 187 ns 188 ns 189 ns
+CLOCK_THREAD_CPUTIME_ID 208 ns 206 ns 207 ns 220 ns
+CLOCK_VIRTUAL 280 ns 279 ns 283 ns 296 ns
+CLOCK_PROF 289 ns 280 ns 282 ns 286 ns
+clock() 342 ns 340 ns 337 ns 344 ns
+CLOCK_UPTIME_PRECISE 197 ns 10380 ns 4402 ns 4097 ns
+CLOCK_REALTIME 196 ns 10376 ns 4337 ns 4054 ns
+CLOCK_MONOTONIC_PRECISE 198 ns 10493 ns 4413 ns 3958 ns
+CLOCK_UPTIME 197 ns 10523 ns 4458 ns 4058 ns
+gettimeofday() 202 ns 10524 ns 4186 ns 3962 ns
+CLOCK_REALTIME_PRECISE 197 ns 10599 ns 4394 ns 4060 ns
+CLOCK_MONOTONIC 201 ns 10766 ns 4498 ns 3943 ns
+======================== ====== ========= ======= =======
+
+Each function was called 100,000 times and CLOCK_MONOTONIC was used to get
+the time before and after. The benchmark was run 5 times to keep the minimum
+time.
+
NTP adjustment
@@ -827,16 +854,17 @@
so usually higher than 1 GHz. Its priority is 300 by default, but
falls to 0 if the processor frequency changes and the counter
becomes unstable.
-* HPET: An HPET chip consists of a 64-bit up-counter (main counter)
- counting at least at 10 MHz and a set of up to 256 comparators (at
- least 3). Each HPET can have up to 32 timers.
+* HPET: An High Precision Event Timer (HPET) chip consists of a 64-bit
+ up-counter (main counter) counting at least at 10 MHz and a set of up to 256
+ comparators (at least 3). Each HPET can have up to 32 timers. HPET can
+ cause around 3 seconds of drift per day.
* PIT (programmable interrupt timer): Intel 8253/8254 chipsets with a
configurable frequency in range 18.2 Hz - 1.2 MHz. Linux uses the
frequency 1,193,181.8 Hz. It is a 16-bit counter.
* PMTMR (power management timer): ACPI 24-bit timer with a frequency
of 3.5 MHz (3,579,545 Hz). Its priority is 200 by default, but
changes to 110 if the chipset is broken and need a software
- workaround. HPET can cause around 3 seconds of drift per day.
+ workaround.
* Cyclone: The Cyclone timer uses a 32-bit counter on IBM Extended
X-Architecture (EXA) chipsets which include computers that use the
IBM "Summit" series chipsets (ex: x440). This is available in IA32
@@ -859,11 +887,38 @@
FreeBSD timers
--------------
-The sysctl program can be used to change the timecounter. For example::
+kern.timecounter.choice list available hardward clocks with their priority.
+The sysctl program can be used to change the timecounter. Example::
+ # dmesg|grep Timecounter
+ Timecounter "i8254" frequency 1193182 Hz quality 0
+ Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
+ Timecounter "HPET" frequency 100000000 Hz quality 900
+ Timecounter "TSC" frequency 3411154800 Hz quality 800
+ Timecounters tick every 10.000 msec
+ # sysctl kern.timecounter.choice
+ kern.timecounter.choice: TSC(800) HPET(900) ACPI-safe(850) i8254(0) dummy(-1000000)
# sysctl kern.timecounter.hardware="ACPI-fast"
kern.timecounter.hardware: HPET -> ACPI-fast
+Available clocks:
+
+ * "TSC": Time Stamp Counter of the procesor
+ * "HPET": High Precision Event Timer
+ * "ACPI-fast": ACPI Power Management timer (fast mode)
+ * "ACPI-safe": ACPI Power Management timer (safe mode)
+ * "i8254": PIT with Intel 8254 chipset
+
+The `commit 222222
+<http://svnweb.freebsd.org/base?view=revision&revision=222222>`_ (May 2011)
+decreased ACPI-fast timecounter quality to 900 and increased HPET timecounter
+quality to 950: "HPET on modern platforms usually have better resolution and
+lower latency than ACPI timer".
+
+Read `Timecounters: Efficient and precise timekeeping in SMP kernels
+<http://phk.freebsd.dk/pubs/timecounter.pdf`_ by Poul-Henning Kamp (2002) for
+the FreeBSD Project.
+
Sleep, suspend and monotonic time
=================================
@@ -1247,6 +1302,9 @@
bits of time
* `Win32 Performance Measurement Options
<http://drdobbs.com/windows/184416651>`_ by Matthew Wilson, May 01, 2003
+* `Counter Availability and Characteristics for Feed-forward Based Synchronization
+ <http://www.cubinlab.ee.unimelb.edu.au/~jrid/Publications/ridoux_ispcs09.pdf>`_
+ by Timothy Broomhead, Julien Ridoux, Darryl Veitch (2009)
* System Management Interrupt (SMI) issues:
* `System Management Interrupt Free Hardware
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list