2 .\" Copyright (c) 2021 Netflix, Inc.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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.
39 .Vt extern int stathz;
40 .Vt extern int profhz; /* deprecated */
43 utilizes periodic, one-shot, global or per-CPU
46 to produce traditional clock behavior.
47 These clocks regulate periodic events in the system.
49 The main clock is used to update the system's notion of time via
51 and to pace periodic system processing as documented in
53 That routine may be called once every 1 /
55 seconds, though the call is omitted if no work is needed in the next tick and it
56 has not been 0.5 seconds since the last call.
58 The stat clock running at
60 gathers statistics on the system and its processes.
61 It computes values for
63 and statistics displayed by
68 Finally, a profiling clock may run at
70 to sample user program counter values for profiling purposes.
71 This profiling mechanism has been replaced by the more functional
73 and may be removed in a future version of
77 is the length of time in microseconds of one system tick.
79 These system variables are also available as
88 The current global and per-CPU CPU time usage is returned to the user in units
99 rate may be overridden by defining
101 in the kernel configuration file or setting
106 The current default is 1000 Hz for a tick of 1 ms for real hardware.
107 For virtual machine guests, the default is 100 Hz for a tick of 10 ms.
108 Only override the default value if you really know what you are doing.
109 Due to the adaptive nature of timeouts, changing this value has less effect than
115 .Xr timer_settime 2 ,
122 .Sh IMPLEMENTATION NOTES
123 Historically, both the
127 clocks have run off the same physical timer running at the slower rate when no
128 process is using the profile features, or at the higher rate when at least one
130 Although the interface is deprecated by
133 .Xr timer_settime 2 ,
134 several programs still use
138 for a higher-resolution periodic interrupt than has been traditionally
143 has also been run off a separate interrupt, except on constrained platforms that
144 lack enough periodic interrupt sources.
148 to abstract these details away, though some old code may still harbor
149 assumptions that are an imperfect fit to this abstraction.
152 are limited to 32-bits and wrap after about a second, so we must update the
153 time hands they maintain at least every half second to get the proper wrapping
157 needs to updated at least once a second so that the values displayed by