1.\" $OpenBSD: hz.9,v 1.3 2000/10/12 18:05:59 aaron Exp $ 2.\" 3.\" Copyright (c) 1999 Marc Espie 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by Marc Espie 17.\" for the OpenBSD Project. 18.\" 3. The name of the author may not be used to endorse or promote products 19.\" derived from this software without specific prior written permission 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31.\" 32.Dd August 31, 1999 33.Dt HZ 9 34.Os 35.Sh NAME 36.Nm hz , 37.Nm tick , 38.Nm tickadj , 39.Nm stathz , 40.Nm profhz 41.Nd system time model. 42.Sh SYNOPSIS 43.Va extern int hz; 44.br 45.Va extern int tick; 46.br 47.Va extern int tickadj; 48.br 49.Va extern int stathz; 50.br 51.Va extern int profhz; 52.Sh DESCRIPTION 53The system is driven by 54.Xr hardclock 9 55interrupts, which occur at 56.Va hz 57frequency, and are used to keep track of real time. 58.Pp 59On systems where another independent clock is available, it is set at 60.Va stathz 61frequency, and used to gather timing statistics. 62Ideally, it would be better to drive 63.Va stathz 64with a slightly randomized clock, that is still a fixed number on average, 65as this would prevent malicious processes from working around the scheduler. 66If a separate clock is not available, 67.Va stathz 68is set to 69.Va hz . 70.Pp 71If profiling is enabled, the clock normally used to drive 72.Va stathz 73may be run at a higher rate 74.Va profhz , 75which must be a multiple of 76.Va stathz . 77This will give higher resolution profiling information. 78.Pp 79Normally, 80.Xr hardclock 9 81increments 82.Va time 83by 84.Va tick 85each time it is called. 86If the system clock has drifted, 87.Xr adjtime 2 88may be used to skew this increment, but by no more 89than ten times 90.Va tickadj . 91.Pp 92Those systems variables are available as a struct clockinfo from 93.Xr sysctl 3 . 94.Sh SEE ALSO 95.Xr adjtime 2 , 96.Xr clock_getres 2 , 97.Xr sysctl 3 , 98.Xr hardclock 9 , 99.Xr microtime 9 100