TIMECOUNTERS(4FREEBSD) - Linux man page online | Special files

Kernel time counters subsystem.

August 12, 2015
TIMECOUNTERS(4) BSD Kernel Interfaces Manual TIMECOUNTERS(4)


timecounters — kernel time counters subsystem


The kernel uses several types of time-related devices, such as: real time clocks, time coun‐ ters and event timers. Real time clocks are responsible for tracking real world time, mostly when the system is down. Time counters are responsible for tracking purposes, when the system is running. Event timers are responsible for generating interrupts at a speci‐ fied time or periodically, to run different time-based events. This page is about the sec‐ ond.


Time counters are the lowest level of time tracking in the kernel. They provide monotoni‐ cally increasing timestamps with known width and update frequency. They can overflow, drift, etc and so in raw form can be used only in very limited performance-critical places like the process scheduler. More usable time is created by scaling the values read from the selected time counter and combining it with some offset, regularly updated by tc_windup() on hardclock() invocation. Different platforms provide different kinds of timer hardware. The goal of the time coun‐ ters subsystem is to provide a unified way to access that hardware. Each driver implementing time counters registers them with the subsystem. It is possible to see the list of present time counters, via the kern.timecounter sysctl(8) variable: kern.timecounter.choice: TSC-low(-100) HPET(950) i8254(0) ACPI-fast(900) dummy(-1000000) 16777215 13467909 3579545 900 65535 62692 1193182 0 4294967295 3013495652 14318180 950 4294967295 4067509463 11458556 -100 The output nodes are defined as follows: is a bitmask, defining valid counter bits, is a present counter value, is a counter update frequency, is an integral value, defining the quality of this time counter compared to others. A negative value means this time counter is broken and should not be used. The time management code of the kernel automatically switches to a higher-quality time counter when it registers, unless the kern.timecounter.hardware sysctl has been used to choose a specific device. There is no way to unregister a time counter once it has registered with the kernel. If a dynamically loaded module contains a time counter you will not be able to unload that mod‐ ule, even if the time counter it contains is not the one currently in use.


attimer(4), eventtimers(4), ffclock(4), hpet(4)
BSD August 12, 2015 BSD
This manual Reference Other manuals
timecounters(4freebsd) referred by acpi_hpet(4freebsd) | attimer(4freebsd) | CPU_ELAN(4freebsd) | CPU_SOEKRIS(4freebsd) | cpufreq(4freebsd) | eventtimers(4freebsd) | ffclock(4freebsd) | hpet(4freebsd) | i8254(4freebsd)
refer to attimer(4freebsd) | eventtimers(4freebsd) | ffclock(4freebsd) | hpet(4freebsd) | sysctl(8)
Download raw manual
Index BSD Kernel Interfaces Manual (+773) BSD (+3984) № 4 (+981)
Go top