Module Name: src Committed By: jruoho Date: Thu Mar 25 14:59:37 UTC 2010
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile hz.9 Log Message: In addition to 'hz', document also 'tick', 'tickadj', 'stathz', and 'profhz'. The idea comes from OpenBSD, but this was written largely based on the comments in kern_clock.c. XXX: schedhz? To generate a diff of this commit: cvs rdiff -u -r1.1417 -r1.1418 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.322 -r1.323 src/share/man/man9/Makefile cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/hz.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1417 src/distrib/sets/lists/comp/mi:1.1418 --- src/distrib/sets/lists/comp/mi:1.1417 Thu Mar 25 10:21:09 2010 +++ src/distrib/sets/lists/comp/mi Thu Mar 25 14:59:36 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1417 2010/03/25 10:21:09 jruoho Exp $ +# $NetBSD: mi,v 1.1418 2010/03/25 14:59:36 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -9365,6 +9365,7 @@ ./usr/share/man/cat9/printf.0 comp-sys-catman .cat ./usr/share/man/cat9/printf_nolog.0 comp-sys-catman .cat ./usr/share/man/cat9/proc_trampoline.0 comp-sys-catman .cat +./usr/share/man/cat9/profhz.0 comp-sys-catman .cat ./usr/share/man/cat9/prop_array_copyin_ioctl.0 comp-sys-catman .cat ./usr/share/man/cat9/prop_array_copyout_ioctl.0 comp-sys-catman .cat ./usr/share/man/cat9/prop_copy.0 comp-obsolete obsolete @@ -9511,6 +9512,7 @@ ./usr/share/man/cat9/splvm.0 comp-sys-catman .cat ./usr/share/man/cat9/splx.0 comp-sys-catman .cat ./usr/share/man/cat9/sprintf.0 comp-sys-catman .cat +./usr/share/man/cat9/stathz.0 comp-sys-catman .cat ./usr/share/man/cat9/store.0 comp-sys-catman .cat ./usr/share/man/cat9/subyte.0 comp-sys-catman .cat ./usr/share/man/cat9/suibyte.0 comp-sys-catman .cat @@ -9567,6 +9569,8 @@ ./usr/share/man/cat9/tc_syncbus.0 comp-sys-catman .cat ./usr/share/man/cat9/tc_wmb.0 comp-sys-catman .cat ./usr/share/man/cat9/tcp_congctl.0 comp-sys-catman .cat +./usr/share/man/cat9/tick.0 comp-sys-catman .cat +./usr/share/man/cat9/tickadj.0 comp-sys-catman .cat ./usr/share/man/cat9/time.0 comp-obsolete obsolete ./usr/share/man/cat9/time_second.0 comp-sys-catman .cat ./usr/share/man/cat9/time_uptime.0 comp-sys-catman .cat @@ -15020,6 +15024,7 @@ ./usr/share/man/html9/printf.html comp-sys-htmlman html ./usr/share/man/html9/printf_nolog.html comp-sys-htmlman html ./usr/share/man/html9/proc_trampoline.html comp-sys-htmlman html +./usr/share/man/html9/profhz.html comp-sys-htmlman html ./usr/share/man/html9/prop_array_copyin_ioctl.html comp-sys-htmlman html ./usr/share/man/html9/prop_array_copyout_ioctl.html comp-sys-htmlman html ./usr/share/man/html9/prop_copyin_ioctl.html comp-sys-htmlman html @@ -15148,6 +15153,7 @@ ./usr/share/man/html9/splvm.html comp-sys-htmlman html ./usr/share/man/html9/splx.html comp-sys-htmlman html ./usr/share/man/html9/sprintf.html comp-sys-htmlman html +./usr/share/man/html9/stathz.html comp-sys-htmlman html ./usr/share/man/html9/store.html comp-sys-htmlman html ./usr/share/man/html9/subyte.html comp-sys-htmlman html ./usr/share/man/html9/suibyte.html comp-sys-htmlman html @@ -15203,6 +15209,8 @@ ./usr/share/man/html9/tc_syncbus.html comp-sys-htmlman html ./usr/share/man/html9/tc_wmb.html comp-sys-htmlman html ./usr/share/man/html9/tcp_congctl.html comp-sys-htmlman html +./usr/share/man/html9/tick.html comp-sys-htmlman html +./usr/share/man/html9/tickadj.html comp-sys-htmlman html ./usr/share/man/html9/time_second.html comp-sys-htmlman html ./usr/share/man/html9/time_uptime.html comp-sys-htmlman html ./usr/share/man/html9/timecounter.html comp-sys-htmlman html @@ -20844,6 +20852,7 @@ ./usr/share/man/man9/printf.9 comp-sys-man .man ./usr/share/man/man9/printf_nolog.9 comp-sys-man .man ./usr/share/man/man9/proc_trampoline.9 comp-sys-man .man +./usr/share/man/man9/profhz.9 comp-sys-man .man ./usr/share/man/man9/prop_array_copyin_ioctl.9 comp-sys-man .man ./usr/share/man/man9/prop_array_copyout_ioctl.9 comp-sys-man .man ./usr/share/man/man9/prop_copy.9 comp-obsolete obsolete @@ -20990,6 +20999,7 @@ ./usr/share/man/man9/splvm.9 comp-sys-man .man ./usr/share/man/man9/splx.9 comp-sys-man .man ./usr/share/man/man9/sprintf.9 comp-sys-man .man +./usr/share/man/man9/stathz.9 comp-sys-man .man ./usr/share/man/man9/store.9 comp-sys-man .man ./usr/share/man/man9/subyte.9 comp-sys-man .man ./usr/share/man/man9/suibyte.9 comp-sys-man .man @@ -21046,6 +21056,8 @@ ./usr/share/man/man9/tc_syncbus.9 comp-sys-man .man ./usr/share/man/man9/tc_wmb.9 comp-sys-man .man ./usr/share/man/man9/tcp_congctl.9 comp-sys-man .man +./usr/share/man/man9/tick.9 comp-sys-man .man +./usr/share/man/man9/tickadj.9 comp-sys-man .man ./usr/share/man/man9/time.9 comp-obsolete obsolete ./usr/share/man/man9/time_second.9 comp-sys-man .man ./usr/share/man/man9/time_uptime.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.322 src/share/man/man9/Makefile:1.323 --- src/share/man/man9/Makefile:1.322 Thu Mar 25 10:09:54 2010 +++ src/share/man/man9/Makefile Thu Mar 25 14:59:36 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.322 2010/03/25 10:09:54 jruoho Exp $ +# $NetBSD: Makefile,v 1.323 2010/03/25 14:59:36 jruoho Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -290,6 +290,10 @@ MLINKS+=hash.9 hash32_buf.9 hash.9 hash32_str.9 hash.9 hash32_strn.9 MLINKS+=hashinit.9 hashdone.9 MLINKS+=humanize_number.9 format_bytes.9 +MLINKS+=hz.9 profhz.9 \ + hz.9 stathz.9 \ + hz.9 tick.9 \ + hz.9 tickadj.9 MLINKS+=ieee80211.9 ieee80211_chan2ieee.9 \ ieee80211.9 ieee80211_chan2mode.9 \ ieee80211.9 ieee80211_ieee2mhz.9 \ Index: src/share/man/man9/hz.9 diff -u src/share/man/man9/hz.9:1.7 src/share/man/man9/hz.9:1.8 --- src/share/man/man9/hz.9:1.7 Thu Mar 4 09:57:12 2010 +++ src/share/man/man9/hz.9 Thu Mar 25 14:59:36 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: hz.9,v 1.7 2010/03/04 09:57:12 jruoho Exp $ +.\" $NetBSD: hz.9,v 1.8 2010/03/25 14:59:36 jruoho Exp $ .\" .\" Copyright (c) 2001 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,31 +27,81 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 4, 2001 +.Dd March 25, 2010 .Dt HZ 9 .Os .Sh NAME -.Nm hz -.Nd system clock frequency +.Nm hz, tick, tickadj, stathz, profhz +.Nd system time model .Sh SYNOPSIS .In sys/kernel.h .Pp -.Va extern int hz; +.Vt extern int hz; +.Vt extern int tick; +.Vt extern int tickadj; +.Vt extern int stathz; +.Vt extern int profhz; +.\" XXX: .Vt extern int schedhz; ? .Sh DESCRIPTION -.Nm +The essential clock handling routines in +.Nx +are written to operate with two timers that run independently of each other. +The main clock, running +.Va hz +times per second, is used to keep track of real time. +.Pp +In another words, +.Va hz specifies the number of times the .Xr hardclock 9 timer ticks per second. -.Nm -is hardware-dependent; it can be overridden (if the machine dependent -code supports this) by defining -.Em HZ +Normally +.Xr hardclock 9 +increments time by +.Va tick +each time it is called. +If the system clock has drifted, +.Xr adjtime 2 +may be used to skew this increment based on the rate of +.Va tickadj . +.Pp +The second timer is used to gather timing statistics. +It also handles kernel and user profiling. +If the second timer is programmable, +it is randomized to avoid aliasing between the two clocks. +The mean frequency of the second timer is +.Va stathz . +If a separate clock is not available, +.Va stathz +is set to +.Va hz . +.Pp +If profiling is enabled, the clock normally used to drive +.Va stathz +may be run at a higher rate +.Va profhz , +which is required to be a multiple of +.Va stathz . +This will give higher resolution profiling information. +.Pp +These system variables are also available as +.Em struct clockinfo +from +.Xr sysctl 3 +and +.Sy kern.clockrate +from +.Xr sysctl 8 . +The +.Va hz +is hardware-dependent; it can be overridden +(if the machine dependent code supports this) by defining +.Dv HZ in the kernel configuration file (see .Xr options 4 ) . -Only override the default value if you really know what you are -doing. +Only override the default value if you really know what you are doing. .Sh SEE ALSO -.Xr options 4 , +.Xr adjtime 2 , .Xr callout 9 , .Xr hardclock 9 , .Xr microtime 9 ,