xref: /freebsd/share/man/man9/hardclock.9 (revision 195aa533c7998d2ad236f1492b4bf232b5a32080)
14c0bc591SWarner Losh.\"	$NetBSD: hardclock.9,v 1.3 2010/03/25 15:17:38 jruoho Exp $
24c0bc591SWarner Losh.\"
34c0bc591SWarner Losh.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
44c0bc591SWarner Losh.\" All rights reserved.
54c0bc591SWarner Losh.\"
64c0bc591SWarner Losh.\" This code is derived from software contributed to The NetBSD Foundation
74c0bc591SWarner Losh.\" by Thomas Klausner.
84c0bc591SWarner Losh.\"
94c0bc591SWarner Losh.\" Redistribution and use in source and binary forms, with or without
104c0bc591SWarner Losh.\" modification, are permitted provided that the following conditions
114c0bc591SWarner Losh.\" are met:
124c0bc591SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
134c0bc591SWarner Losh.\"    notice, this list of conditions and the following disclaimer.
144c0bc591SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright
154c0bc591SWarner Losh.\"    notice, this list of conditions and the following disclaimer in the
164c0bc591SWarner Losh.\"    documentation and/or other materials provided with the distribution.
174c0bc591SWarner Losh.\"
184c0bc591SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
194c0bc591SWarner Losh.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
204c0bc591SWarner Losh.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
214c0bc591SWarner Losh.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
224c0bc591SWarner Losh.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
234c0bc591SWarner Losh.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
244c0bc591SWarner Losh.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
254c0bc591SWarner Losh.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
264c0bc591SWarner Losh.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
274c0bc591SWarner Losh.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
284c0bc591SWarner Losh.\" POSSIBILITY OF SUCH DAMAGE.
294c0bc591SWarner Losh.\"
30*195aa533SMitchell Horne.Dd February 27, 2023
314c0bc591SWarner Losh.Dt HARDCLOCK 9
324c0bc591SWarner Losh.Os
334c0bc591SWarner Losh.Sh NAME
344c0bc591SWarner Losh.Nm hardclock
354c0bc591SWarner Losh.Nd real-time timer
364c0bc591SWarner Losh.Sh SYNOPSIS
374c0bc591SWarner Losh.Ft void
384c0bc591SWarner Losh.Fn hardclock "int cnt" "int usermode"
394c0bc591SWarner Losh.Sh DESCRIPTION
404c0bc591SWarner LoshThe
414c0bc591SWarner Losh.Fn hardclock
426329ca32SWarner Loshfunction is called periodically based on pending work.
436329ca32SWarner LoshThe rate ranges from
446329ca32SWarner Losh.Va hz
456329ca32SWarner Loshtimes per second on a very busy system, to twice a second on an idle system.
466329ca32SWarner LoshThe
47*195aa533SMitchell Horne.Fa cnt
486329ca32SWarner Loshargument reports an estimate of the number of ticks since the last call.
49*195aa533SMitchell HorneOver long timescales, the average sum of
50*195aa533SMitchell Horne.Fa cnt
51*195aa533SMitchell Horneover one second is
52*195aa533SMitchell Horne.Va hz .
536329ca32SWarner LoshSee
546329ca32SWarner Losh.Xr hz 9
556329ca32SWarner Loshfor important details over shorter time scales.
56*195aa533SMitchell HorneThe
57*195aa533SMitchell Horne.Fa usermode
58*195aa533SMitchell Horneargument is non-zero when
594c0bc591SWarner Losh.Fn hardclock
606329ca32SWarner Loshis called from an context that interrupted usermode execution.
614c0bc591SWarner Losh.Pp
624c0bc591SWarner Losh.Fn hardclock
634c0bc591SWarner Loshmay perform different tasks such as:
644c0bc591SWarner Losh.Bl -bullet -offset indent
654c0bc591SWarner Losh.It
664c0bc591SWarner LoshRun the current process's virtual and profile time (decrease the
674c0bc591SWarner Loshcorresponding timers, if they are activated, and generate
684c0bc591SWarner Losh.Li SIGVTALRM
694c0bc591SWarner Loshor
704c0bc591SWarner Losh.Li SIGPROF ,
714c0bc591SWarner Loshrespectively).
724c0bc591SWarner Losh.It
734c0bc591SWarner LoshIncrement the time-of-day, taking care of any
744c0bc591SWarner Losh.Xr ntpd 8
754c0bc591SWarner Loshor
764c0bc591SWarner Losh.Xr adjtime 2
774c0bc591SWarner Loshinduced changes and leap seconds, as well as any necessary
784c0bc591SWarner Loshcompensations to keep in sync with PPS signals or external clocks, if
79*195aa533SMitchell Hornesupported by the kernel.
804c0bc591SWarner Losh.It
81*195aa533SMitchell HorneSchedule softclock interrupts
82*195aa533SMitchell Horne.Po
83*195aa533SMitchell Horne.Xr swi 9
84*195aa533SMitchell Horne.Pc
854c0bc591SWarner Loshprocessing.
864c0bc591SWarner Losh.It
874c0bc591SWarner LoshCollect
884c0bc591SWarner Losh.Xr hwpmc 4
894c0bc591SWarner Loshstatistics.
904c0bc591SWarner Losh.It
91*195aa533SMitchell HorneDo device polling, when enabled
92*195aa533SMitchell Horne.Po
93*195aa533SMitchell Hornesee
94*195aa533SMitchell Horne.Xr polling 4
95*195aa533SMitchell Horne.Pc .
964c0bc591SWarner Losh.It
974c0bc591SWarner LoshImplement software
984c0bc591SWarner Losh.Xr watchdog 9
994c0bc591SWarner Loshprocessing.
1004c0bc591SWarner Losh.It
1014c0bc591SWarner LoshEnqueue
1024c0bc591SWarner Losh.Xr epoch 9
1034c0bc591SWarner Loshprocessing.
1044c0bc591SWarner Losh.El
1054c0bc591SWarner Losh.Sh SEE ALSO
1064c0bc591SWarner Losh.Xr adjtime 2 ,
1074c0bc591SWarner Losh.Xr ntp_adjtime 2 ,
1084c0bc591SWarner Losh.Xr signal 3 ,
109*195aa533SMitchell Horne.Xr hwpmc 4 ,
110*195aa533SMitchell Horne.Xr polling 4 ,
1114c0bc591SWarner Losh.Xr ntpd 8 ,
112*195aa533SMitchell Horne.Xr epoch 9 ,
113*195aa533SMitchell Horne.Xr eventtimers 9 ,
114*195aa533SMitchell Horne.Xr hz 9 ,
115*195aa533SMitchell Horne.Xr swi 9 ,
116*195aa533SMitchell Horne.Xr watchdog 9
117