xref: /freebsd/share/man/man9/hz.9 (revision 4c0bc591466fd2731ba892269260b7dab74cfbad)
1*4c0bc591SWarner Losh.\"
2*4c0bc591SWarner Losh.\" Copyright (c) 2021 Netflix, Inc.
3*4c0bc591SWarner Losh.\"
4*4c0bc591SWarner Losh.\" Redistribution and use in source and binary forms, with or without
5*4c0bc591SWarner Losh.\" modification, are permitted provided that the following conditions
6*4c0bc591SWarner Losh.\" are met:
7*4c0bc591SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
8*4c0bc591SWarner Losh.\"    notice, this list of conditions and the following disclaimer.
9*4c0bc591SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright
10*4c0bc591SWarner Losh.\"    notice, this list of conditions and the following disclaimer in the
11*4c0bc591SWarner Losh.\"    documentation and/or other materials provided with the distribution.
12*4c0bc591SWarner Losh.\"
13*4c0bc591SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14*4c0bc591SWarner Losh.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15*4c0bc591SWarner Losh.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16*4c0bc591SWarner Losh.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17*4c0bc591SWarner Losh.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18*4c0bc591SWarner Losh.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19*4c0bc591SWarner Losh.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20*4c0bc591SWarner Losh.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21*4c0bc591SWarner Losh.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22*4c0bc591SWarner Losh.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23*4c0bc591SWarner Losh.\" POSSIBILITY OF SUCH DAMAGE.
24*4c0bc591SWarner Losh.\"
25*4c0bc591SWarner Losh.Dd June 18, 2021
26*4c0bc591SWarner Losh.Dt HZ 9
27*4c0bc591SWarner Losh.Os
28*4c0bc591SWarner Losh.Sh NAME
29*4c0bc591SWarner Losh.Nm hz ,
30*4c0bc591SWarner Losh.Nm tick ,
31*4c0bc591SWarner Losh.Nm stathz ,
32*4c0bc591SWarner Losh.Nm profhz
33*4c0bc591SWarner Losh.Nd system time model
34*4c0bc591SWarner Losh.Sh SYNOPSIS
35*4c0bc591SWarner Losh.In sys/kernel.h
36*4c0bc591SWarner Losh.Pp
37*4c0bc591SWarner Losh.Vt extern int hz;
38*4c0bc591SWarner Losh.Vt extern int tick;
39*4c0bc591SWarner Losh.Vt extern int stathz;	/* deprecated */
40*4c0bc591SWarner Losh.Vt extern int profhz;	/* deprecated */
41*4c0bc591SWarner Losh.Sh DESCRIPTION
42*4c0bc591SWarner Losh.Fx
43*4c0bc591SWarner Loshutilizes periodic, one-shot, global or per-CPU
44*4c0bc591SWarner Loshtiming hardware using
45*4c0bc591SWarner Losh.Xr eventtimers 9
46*4c0bc591SWarner Loshto produce traditional clock behavior.
47*4c0bc591SWarner Losh.Pp
48*4c0bc591SWarner LoshThe main clock is used to update the system's notion of time via
49*4c0bc591SWarner Losh.Xr timecounters 9
50*4c0bc591SWarner Loshand to pace periodic system callbacks via
51*4c0bc591SWarner Losh.Xr callout 9 ,
52*4c0bc591SWarner Losh.Xr epoch 9 ,
53*4c0bc591SWarner Loshand other methods documented in
54*4c0bc591SWarner Losh.Xr hardclock 9 .
55*4c0bc591SWarner LoshThat routine will be called approximately
56*4c0bc591SWarner Losh.Va hz
57*4c0bc591SWarner Loshtimes per second.
58*4c0bc591SWarner Losh.Pp
59*4c0bc591SWarner LoshThe second clock, running at either
60*4c0bc591SWarner Losh.Va stathz
61*4c0bc591SWarner Loshor
62*4c0bc591SWarner Losh.Va profhz
63*4c0bc591SWarner Loshwas used to gather timing statistics, but has been replaced with the more
64*4c0bc591SWarner Loshfunctional
65*4c0bc591SWarner Losh.Xr hwpmc 4 .
66*4c0bc591SWarner LoshThese values are returned for
67*4c0bc591SWarner Losh.Qq compatibility
68*4c0bc591SWarner Loshwith
69*4c0bc591SWarner Losh.Bx 4.4 ,
70*4c0bc591SWarner Losh.St -p1003.1-2001
71*4c0bc591SWarner Loshand the
72*4c0bc591SWarner Losh.Xr setitimer 2
73*4c0bc591SWarner Losh.Va ITIMER_PROF
74*4c0bc591SWarner Loshflag, which were deprecated in
75*4c0bc591SWarner Losh.St -p1003.1-2008
76*4c0bc591SWarner Loshin favor of
77*4c0bc591SWarner Losh.Xr timer_settime 2 .
78*4c0bc591SWarner Losh.Pp
79*4c0bc591SWarner Losh.Va tick
80*4c0bc591SWarner Loshis the length of time in microseconds of one system tick.
81*4c0bc591SWarner Losh.Pp
82*4c0bc591SWarner LoshThese system variables are also available as
83*4c0bc591SWarner Losh.Em struct clockinfo
84*4c0bc591SWarner Loshfrom
85*4c0bc591SWarner Losh.Xr sysctl 3
86*4c0bc591SWarner Loshand
87*4c0bc591SWarner Losh.Sy kern.clockrate
88*4c0bc591SWarner Loshfrom
89*4c0bc591SWarner Losh.Xr sysctl 8 .
90*4c0bc591SWarner Losh.Pp
91*4c0bc591SWarner LoshThe
92*4c0bc591SWarner Losh.Va hz
93*4c0bc591SWarner Loshrate may be overridden by defining
94*4c0bc591SWarner Losh.Dv HZ
95*4c0bc591SWarner Loshin the kernel configuration file or setting
96*4c0bc591SWarner Losh.Sy kern.hz
97*4c0bc591SWarner Loshsystem tuneable via
98*4c0bc591SWarner Losh.Xr loader.conf 5 .
99*4c0bc591SWarner Losh.Pp
100*4c0bc591SWarner LoshThe current default is 1000 Hz for a tick of 1 ms for real hardware.
101*4c0bc591SWarner LoshFor virtual machine guests, the default is 100 Hz for a tick of 10 ms.
102*4c0bc591SWarner LoshOnly override the default value if you really know what you are doing.
103*4c0bc591SWarner LoshDue to the adaptive nature of timeouts, changing this value has less effect than
104*4c0bc591SWarner Loshit had in the past.
105*4c0bc591SWarner Losh.Sh SEE ALSO
106*4c0bc591SWarner Losh.Xr setitimer 2 ,
107*4c0bc591SWarner Losh.Xr timer_settime 2 ,
108*4c0bc591SWarner Losh.Xr loader.conf 5 ,
109*4c0bc591SWarner Losh.Xr callout 9 ,
110*4c0bc591SWarner Losh.Xr eventtimers 9 ,
111*4c0bc591SWarner Losh.Xr hardclock 9 ,
112*4c0bc591SWarner Losh.Xr microtime 9 ,
113*4c0bc591SWarner Losh.Xr time_second 9 ,
114*4c0bc591SWarner Losh.Xr timecounters 9
115