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