Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

timecounters(4) [freebsd man page]

TIMECOUNTERS(4) 					   BSD Kernel Interfaces Manual 					   TIMECOUNTERS(4)

NAME
timecounters -- kernel time counters subsystem SYNOPSIS
The kernel uses several types of time-related devices, such as: real time clocks, time counters 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 sys- tem is running. Event timers are responsible for generating interrupts at a specified time or periodically, to run different time-based events. This page is about the second. DESCRIPTION
Time counters are the lowest level of time tracking in the kernel. They provide monotonically 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 counters 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) kern.timecounter.tc.ACPI-fast.mask: 16777215 kern.timecounter.tc.ACPI-fast.counter: 13467909 kern.timecounter.tc.ACPI-fast.frequency: 3579545 kern.timecounter.tc.ACPI-fast.quality: 900 kern.timecounter.tc.i8254.mask: 65535 kern.timecounter.tc.i8254.counter: 62692 kern.timecounter.tc.i8254.frequency: 1193182 kern.timecounter.tc.i8254.quality: 0 kern.timecounter.tc.HPET.mask: 4294967295 kern.timecounter.tc.HPET.counter: 3013495652 kern.timecounter.tc.HPET.frequency: 14318180 kern.timecounter.tc.HPET.quality: 950 kern.timecounter.tc.TSC-low.mask: 4294967295 kern.timecounter.tc.TSC-low.counter: 4067509463 kern.timecounter.tc.TSC-low.frequency: 11458556 kern.timecounter.tc.TSC-low.quality: -100 The output nodes are defined as follows: kern.timecounter.tc.X.mask is a bitmask, defining valid counter bits, kern.timecounter.tc.X.counter is a present counter value, kern.timecounter.tc.X.frequency is a counter update frequency, kern.timecounter.tc.X.quality 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 chooses one time counter from that list. The current choice can be read and affected via the kern.timecounter.hardware tunable/sysctl. SEE ALSO
attimer(4), eventtimers(4), ffclock(4), hpet(4) BSD
April 12, 2014 BSD

Check Out this Related Man Page

MICROTIME(9)						   BSD Kernel Developer's Manual					      MICROTIME(9)

NAME
bintime, getbintime, microtime, getmicrotime, nanotime, getnanotime -- get the current time SYNOPSIS
#include <sys/time.h> void bintime(struct bintime *bt); void getbintime(struct bintime *bt); void microtime(struct timeval *tv); void getmicrotime(struct timeval *tv); void nanotime(struct timespec *ts); void getnanotime(struct timespec *tsp); DESCRIPTION
The bintime() and getbintime() functions store the system time as a struct bintime at the addresses specified by bt. The microtime() and getmicrotime() functions perform the same utility, but record the time as a struct timeval instead. Similarly the nanotime() and getnanotime() functions store the time as a struct timespec. The structures are described in timeval(3). The bintime(), microtime(), and nanotime() functions always query the timecounter to return the current time as precisely as possible. Whereas getbintime(), getmicrotime(), and getnanotime() functions are abstractions which return a less precise, but faster to obtain, time. The intent of the getbintime(), getmicrotime(), and getnanotime() functions is to enforce the user's preference for timer accuracy versus execution time. They should be used where a precision of 1/HZ (e.g., 10 msec on a 100HZ machine, see hz(9)) is acceptable or where perfor- mance is priority. The system realtime clock is guaranteed to be monotonically increasing at all times. As such, all calls to these functions are guaranteed to return a system time greater than or equal to the system time returned in any previous calls. Comparable functions exist to retrieve the time elapsed since boot; see microuptime(9). SEE ALSO
settimeofday(2), bintime_add(9), inittodr(9), time_second(9), tvtohz(9) CODE REFERENCES
The implementation of the microtime() family of functions is in sys/kern/kern_tc.c as a part of the timecounter(9) framework. The implementation of the time counter sources used by the timecounter(9) is machine dependent, hence its location in the source code tree varies from architecture to architecture. AUTHORS
This manual page was written by Jeremy Cooper and Kelly Yancey <kbyanc@posi.net>. BUGS
Despite the guarantee that the system realtime clock will always be monotonically increasing, it is always possible for the system clock to be manually reset by the system administrator to any date. BSD
June 8, 2010 BSD
Man Page