1.\" $OpenBSD: hz.9,v 1.7 2007/05/31 19:20:00 jmc 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.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" 26.Dd $Mdocdate: May 31 2007 $ 27.Dt HZ 9 28.Os 29.Sh NAME 30.Nm hz , 31.Nm tick , 32.Nm tickadj , 33.Nm stathz , 34.Nm profhz 35.Nd system time model 36.Sh SYNOPSIS 37.Vt extern int hz; 38.Vt extern int tick; 39.Vt extern int tickadj; 40.Vt extern int stathz; 41.Vt extern int profhz; 42.Sh DESCRIPTION 43The system is driven by 44.Xr hardclock 9 45interrupts, which occur at 46.Va hz 47frequency, and are used to keep track of real time. 48.Pp 49On systems where another independent clock is available, it is set at 50.Va stathz 51frequency, and used to gather timing statistics. 52Ideally, it would be better to drive 53.Va stathz 54with a slightly randomized clock, that is still a fixed number on average, 55as this would prevent malicious processes from working around the scheduler. 56If a separate clock is not available, 57.Va stathz 58is set to 59.Va hz . 60.Pp 61If profiling is enabled, the clock normally used to drive 62.Va stathz 63may be run at a higher rate 64.Va profhz , 65which must be a multiple of 66.Va stathz . 67This will give higher resolution profiling information. 68.Pp 69Normally, 70.Xr hardclock 9 71increments 72.Va time 73by 74.Va tick 75each time it is called. 76If the system clock has drifted, 77.Xr adjtime 2 78may be used to skew this increment, but by no more 79than ten times 80.Va tickadj . 81.Pp 82Those systems variables are available as a struct clockinfo from 83.Xr sysctl 3 . 84.Sh SEE ALSO 85.Xr adjtime 2 , 86.Xr clock_getres 2 , 87.Xr sysctl 3 , 88.Xr hardclock 9 , 89.Xr microtime 9 90