Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/hardclock.9
Show All 21 Lines | |||||
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
.\" POSSIBILITY OF SUCH DAMAGE. | .\" POSSIBILITY OF SUCH DAMAGE. | ||||
.\" | .\" | ||||
.Dd July 1, 2021 | .Dd February 27, 2023 | ||||
.Dt HARDCLOCK 9 | .Dt HARDCLOCK 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm hardclock | .Nm hardclock | ||||
.Nd real-time timer | .Nd real-time timer | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Ft void | .Ft void | ||||
.Fn hardclock "int cnt" "int usermode" | .Fn hardclock "int cnt" "int usermode" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn hardclock | .Fn hardclock | ||||
function is called periodically based on pending work. | function is called periodically based on pending work. | ||||
The rate ranges from | The rate ranges from | ||||
.Va hz | .Va hz | ||||
times per second on a very busy system, to twice a second on an idle system. | times per second on a very busy system, to twice a second on an idle system. | ||||
The | The | ||||
.Va cnt | .Fa cnt | ||||
argument reports an estimate of the number of ticks since the last call. | argument reports an estimate of the number of ticks since the last call. | ||||
The sum of | Over long timescales, the average sum of | ||||
.Va cnt | .Fa cnt | ||||
over a second averages | over one second is | ||||
.Va hz | .Va hz . | ||||
over the long haul. | |||||
See | See | ||||
.Xr hz 9 | .Xr hz 9 | ||||
for important details over shorter time scales. | for important details over shorter time scales. | ||||
The argument | The | ||||
.Va usermode | .Fa usermode | ||||
is none-zero when | argument is non-zero when | ||||
.Fn hardclock | .Fn hardclock | ||||
is called from an context that interrupted usermode execution. | is called from an context that interrupted usermode execution. | ||||
.Pp | .Pp | ||||
.Fn hardclock | .Fn hardclock | ||||
may perform different tasks such as: | may perform different tasks such as: | ||||
.Bl -bullet -offset indent | .Bl -bullet -offset indent | ||||
.It | .It | ||||
Run the current process's virtual and profile time (decrease the | Run the current process's virtual and profile time (decrease the | ||||
corresponding timers, if they are activated, and generate | corresponding timers, if they are activated, and generate | ||||
.Li SIGVTALRM | .Li SIGVTALRM | ||||
or | or | ||||
.Li SIGPROF , | .Li SIGPROF , | ||||
respectively). | respectively). | ||||
.It | .It | ||||
Increment the time-of-day, taking care of any | Increment the time-of-day, taking care of any | ||||
.Xr ntpd 8 | .Xr ntpd 8 | ||||
or | or | ||||
.Xr adjtime 2 | .Xr adjtime 2 | ||||
induced changes and leap seconds, as well as any necessary | induced changes and leap seconds, as well as any necessary | ||||
compensations to keep in sync with PPS signals or external clocks, if | compensations to keep in sync with PPS signals or external clocks, if | ||||
support for this is in the kernel (see | supported by the kernel. | ||||
.Xr options 4 ) . | |||||
.It | .It | ||||
Schedule softclock interrupts ( | Schedule softclock interrupts | ||||
.Xr swi 9 ) | .Po | ||||
.Xr swi 9 | |||||
.Pc | |||||
processing. | processing. | ||||
.It | .It | ||||
Collect | Collect | ||||
.Xr hwpmc 4 | .Xr hwpmc 4 | ||||
statistics. | statistics. | ||||
.It | .It | ||||
Do device polling, when enabled. | Do device polling, when enabled | ||||
.Po | |||||
see | |||||
.Xr polling 4 | |||||
.Pc . | |||||
.It | .It | ||||
Implement software | Implement software | ||||
.Xr watchdog 9 | .Xr watchdog 9 | ||||
processing. | processing. | ||||
.It | .It | ||||
Enqueue | Enqueue | ||||
.Xr epoch 9 | .Xr epoch 9 | ||||
processing. | processing. | ||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr adjtime 2 , | .Xr adjtime 2 , | ||||
.Xr ntp_adjtime 2 , | .Xr ntp_adjtime 2 , | ||||
.Xr signal 3 , | .Xr signal 3 , | ||||
.Xr hwpmc 4 , | |||||
.Xr polling 4 , | |||||
.Xr ntpd 8 , | .Xr ntpd 8 , | ||||
.Xr hz 9 | .Xr epoch 9 , | ||||
.Xr eventtimers 9 , | |||||
.Xr hz 9 , | |||||
.Xr swi 9 , | |||||
.Xr watchdog 9 |