PEP 418: Add CLOCK_BOOTTIME and FreeBSD kern.timecounter.hardware sysctl

This commit is contained in:
Victor Stinner 2012-04-10 13:58:42 +02:00
parent 1edb8f9940
commit fef248a199
1 changed files with 28 additions and 1 deletions

View File

@ -260,7 +260,9 @@ Hardware clocks
* TSC (Time Stamp Counter): Historically, the TSC increased with every internal * TSC (Time Stamp Counter): Historically, the TSC increased with every internal
processor clock cycle, but now the rate is usually constant (even if the processor clock cycle, but now the rate is usually constant (even if the
processor changes frequency) and usually equals the maximum processor processor changes frequency) and usually equals the maximum processor
frequency. The instructor RDTSC can be used to read this counter. frequency. Multiple cores having different TSC values. Hibernation of system
will reset TSC value. The instructor RDTSC can be used to read this counter.
CPU frequency scaling for power saving.
* ACPI PMTMR (power management timer): ACPI 24-bit timer with a frequency * ACPI PMTMR (power management timer): ACPI 24-bit timer with a frequency
of 3.5 MHz (3,579,545 Hz). HPET can cause around 3 seconds of drift per day. of 3.5 MHz (3,579,545 Hz). HPET can cause around 3 seconds of drift per day.
* Cyclone: The Cyclone timer uses a 32-bit counter on IBM Extended * Cyclone: The Cyclone timer uses a 32-bit counter on IBM Extended
@ -788,6 +790,31 @@ Read also the `time(7) manual page
<http://www.kernel.org/doc/man-pages/online/pages/man7/time.7.html>`_: <http://www.kernel.org/doc/man-pages/online/pages/man7/time.7.html>`_:
"overview of time and timers". "overview of time and timers".
FreeBSD timers
--------------
The sysctl program can be used to change the timecounter. For example::
# sysctl kern.timecounter.hardware="ACPI-fast"
kern.timecounter.hardware: HPET -> ACPI-fast
Sleep, suspend and monotonic time
=================================
Linux
-----
On Linux, CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW includes time the system
spends in sleep; but it does not include time spent in hibernation (ACPI S3
mode). If the system clock jumps backward, CLOCK_MONOTONIC and
CLOCK_MONOTONIC_RAW are not affected.
Linux 2.6.39 and glibc 2.14 introduces a new clock: CLOCK_BOOTTIME.
CLOCK_BOOTTIME is idential to CLOCK_MONOTONIC, except it also includes any time
spent in suspend. Read also `Waking systems from suspend
<http://lwn.net/Articles/429925/>`_ (March, 2011).
Sleeping Sleeping
======== ========