inet6: only mark autoconf addresses tentative if detached
[dragonfly.git] / share / man / man7 / clocks.7
blobaf43c1a6802df2e9aa70566996b24124d5d6a168
1 .\"
2 .\" Copyright (c) 1996 Joerg Wunsch
3 .\"
4 .\" All rights reserved.
5 .\"
6 .\" This program is free software.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD: src/share/man/man7/clocks.7,v 1.9.2.5 2001/12/17 11:30:15 ru Exp $
29 .\"
30 .Dd January 5, 2019
31 .Dt CLOCKS 7
32 .Os
33 .Sh NAME
34 .Nm clocks
35 .Nd various system timers
36 .Sh SYNOPSIS
37 .In time.h
38 .Sh DESCRIPTION
39 .Ql HZ
40 is not part of the application interface in
41 .Bx .
42 .Pp
43 There are many different real and virtual (timekeeping) clocks with
44 different frequencies:
45 .Bl -bullet -offset XXX
46 .It
47 The scheduling clock.  This is a real clock with frequency that
48 happens to be 100.  It isn't available to applications.
49 .It
50 The statistics clock.  This is a real clock with frequency that
51 happens to be 128.  It isn't directly available to applications.
52 .It
53 The clock reported by
54 .Xr clock 3 .
55 This is a virtual clock with a frequency that happens to be 128.  Its
56 actual frequency is given by the macro
57 .Dv CLOCKS_PER_SEC .
58 Note that
59 .Dv CLOCKS_PER_SEC
60 may be floating point.  Don't use
61 .Fn clock
62 in new programs under
63 .Dx .
64 It is feeble compared with
65 .Xr getrusage 2 .
66 It is provided for ANSI conformance.  It is implemented by calling
67 .Fn getrusage
68 and throwing away information and resolution.
69 .It
70 The clock reported by
71 .Xr times 3 .
72 This is a virtual clock with a frequency that happens to be 128.  Its
73 actual frequency is given by the macro
74 .Dv CLK_TCK
75 (deprecated; don't use) and by
76 .Fn sysconf SC_CLK_TCK
77 and by
78 .Xr sysctl 3 .
79 Note that its frequency may be different from
80 .Dv CLOCKS_PER_SEC .
81 Don't use
82 .Xr times 3
83 in new programs under
84 .Dx .
85 It is feeble compared with
86 .Xr gettimeofday 2
87 together with
88 .Fn getrusage .
89 It is provided for POSIX
90 conformance.  It is implemented by calling
91 .Fn gettimeofday
92 and
93 .Fn getrusage
94 and throwing away information and resolution.
95 .It
96 The profiling clock.  This is a real clock with frequency 1024.
97 It is used mainly by
98 .Xr moncontrol 3
99 and
100 .Xr gprof 1 .
101 Applications should determine its actual frequency using
102 .Xr sysctl 3
103 or by reading it from the header in the profiling data file.
105 The mc14618a clock.  This is a real clock with a nominal frequency of
106 32768.  It is divided down to give the statistic clock and the profiling
107 clock.  It isn't available to applications.
109 The microseconds clock.  This is a virtual clock with frequency
110 1000000.  It is used for most timekeeping in
112 and is exported
113 to applications in
114 .Xr getrusage 2 ,
115 .Xr gettimeofday 2 ,
116 .Xr select 2 ,
117 .Xr getitimer 2 ,
118 etc...  This is the clock that should normally be used
121 applications.
123 The i8254 clock.  This is a real clock/timer with a nominal frequency of
124 1193182.  It is divided down to give the scheduling clock.  It isn't
125 available to applications.
127 The TSC clock (64-bit register) on fifth-generation or later x86 systems.
128 This is a real clock with a frequency that is equivalent to the number of
129 cycles per second of the CPU(s).
130 Its frequency can be found using the sysctl
131 .Va hw.tsc_frequency
132 and its presence via
133 .Va hw.tsc_present .
134 It is used to interpolate between values of the scheduling clock.
135 It is only available to applications in a purely machine-dependent manner.
137 The HPET (High Precision Event Timers).
138 Only main counter is used currently.
139 This CPU timer is expected to be faster than ACPI-fast24 and ACPI-safe,
140 so it should be given higher priority.
141 HPET is not enabled by default.
142 To enable it, you should add
143 .Li debug.acpi.enabled="hpet"
144 to your
145 .Pa /boot/loader.conf .
146 If the HPET is detected and attached,
147 .Va kern.cputimer.name
148 will report
149 .Li HPET .
152 Summary: if
153 .Ql HZ
154 isn't 1000000 then the application is probably using the wrong clock.
155 .Sh SEE ALSO
156 .Xr gprof 1 ,
157 .Xr getitimer 2 ,
158 .Xr getrusage 2 ,
159 .Xr gettimeofday 2 ,
160 .Xr select 2 ,
161 .Xr clock 3 ,
162 .Xr moncontrol 3 ,
163 .Xr times 3 ,
164 .Xr loader.conf 5
165 .Sh AUTHORS
166 .An -nosplit
167 This man page has been written by
168 .An J\(:org Wunsch
169 after a description posted by
170 .An Bruce Evans .