Linux and UNIX Man Pages

Test Your Knowledge in Computers #143
Difficulty: Easy
Apple released a Unix system called Darwin in 2000 which became the core of the Mac OS X operating system, which was later renamed macOS.
True or False?
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

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

NAME
timecounter, tc_init -- machine-independent binary timescale SYNOPSIS
#include <sys/timetc.h> void tc_init(struct timecounter *tc); DESCRIPTION
The timecounter interface is a machine-independent implementation of a binary timescale using whatever hardware support is at hand for track- ing time. A timecounter is a binary counter which has two properties: o it runs at a fixed, known frequency; and o it has sufficient bits to not roll over in less than approximately max(2 msec, 2/HZ seconds) (the value 2 here is really 1 + delta, for some indeterminate value of delta). The interface between the hardware which implements a timecounter and the machine-independent code which uses this to keep track of time is a timecounter structure: struct timecounter { timecounter_get_t *tc_get_timecount; timecounter_pps_t *tc_poll_pps; u_int tc_counter_mask; u_int64_t tc_frequency; const char *tc_name; int tc_quality; void *tc_priv; struct timecounter *tc_next; } The fields of the timecounter structure are described below. u_int (*tc_get_timecount)(struct timecounter *) This function reads the counter. It is not required to mask any unimplemented bits out, as long as they are constant. void (*tc_poll_pps)(struct timecounter *) This function is optional and can be set to NULL. It will be called whenever the timecounter is rewound, and is intended to check for PPS events. Normal hardware does not need it but timecounters which latch PPS in hardware do. tc_counter_mask This mask should mask off any unimplemented bits. tc_frequency Frequency of the counter in Hz. tc_name Name of the timecounter. Can be any NUL-terminated string. tc_quality Used to determine if this timecounter is better than another timecounter - higher means better. Negative means ``only use at explicit request''. tc_priv Pointer to the timecounter's private parts. tc_next For internal use. To register a new timecounter, the hardware device driver should fill a timecounter structure with appropriate values and call the tc_init() function, giving a pointer to the structure as a tc parameter. TIMESTAMP FORMAT
The timestamp format used in the machine independent timecounter implementation is a bintime structure: struct bintime { time_t sec; uint64_t frac; } The sec field records the number of seconds as well as the tv_sec field in the traditional UNIX timeval and timespec structures, described in timeval(3). The frac field records fractional seconds represented in a fully 64 bit integer, i.e. it goes all the way from 0 through 0xFFFFFFFFFFFFFFFF per each second. The effective resolution of the frac value depends on a frequency of the machine dependent timecounter source. The bintime format is a binary number, not a pseudo-decimal number, so it can be used as a simple binary counter without expensive 64 bit arithmetics. CODE REFERENCES
The timecounter framework is implemented in the file sys/kern/kern_tc.c. The bintime structure and related functions are defined in the file <sys/time.h>. SEE ALSO
clock_settime(2), ntp_adjtime(2), settimeofday(2), bintime(9), bintime_add(9), binuptime(9), hz(9), time_second(9) Poul-Henning Kamp, "Timecounters: Efficient and precise timekeeping in SMP kernels", Proceedings of EuroBSDCon 2002, Amsterdam, http://phk.freebsd.dk/pubs/timecounter.pdf, 15-17 November, 2002. HISTORY
The timecounter interface first appeared in FreeBSD, and was ported to NetBSD 4.0 by Frank Kardel and Simon Burge. BSD
June 8, 2010 BSD