]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - share/man/man7/eventtimers.7
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / share / man / man7 / eventtimers.7
1 .\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd September 15, 2010
28 .Dt EVENTTIMERS 4
29 .Os
30 .Sh NAME
31 .Nm eventtimers
32 .Nd kernel event timers subsystem
33 .Sh SYNOPSIS
34 Kernel uses several types of time-related devices, such as: real time clocks,
35 time counters and event timers.
36 Real time clocks responsible for tracking real world time, mostly when system
37 is down.
38 Time counters are responsible for generation of monotonically increasing
39 timestamps for precise uptime tracking purposes, when system is running.
40 Event timers are responsible for generating interrupts at specified time or
41 periodically, to run different time-based events.
42 This page is about the last.
43 .Sh DESCRIPTION
44 Kernel uses time-based events for many different purposes: scheduling,
45 statistics, time keeping, profiling and many other things, based on
46 .Xr callout 9
47 mechanism.
48 These purposes now grouped into three main callbacks:
49 .Bl -tag
50 .It hardclock()
51 .Xr callout 9
52 and timekeeping events entry. Called with frequency defined by hz variable,
53 usually 1000Hz.
54 .It statclock()
55 statistics and scheduler events entry. Called with frequency about 128Hz.
56 .It profclock()
57 profiler events entry. When enabled, called with frequency about 8KHz.
58 .El
59 Different platforms provide different kinds of timer hardware.
60 The goal of the event timers subsystem is to provide unified way to control
61 that hardware, and to use it, supplying kernel with all required time-based
62 events.
63 .Pp
64 Each driver implementing event timers, registers them at the subsystem.
65 It is possible to see the list of present event timers, like this, via
66 .Va kern.eventtimer
67 sysctl:
68 .Bd -literal
69 kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0)
70 kern.eventtimer.et.LAPIC.flags: 15
71 kern.eventtimer.et.LAPIC.frequency: 0
72 kern.eventtimer.et.LAPIC.quality: 400
73 kern.eventtimer.et.i8254.flags: 1
74 kern.eventtimer.et.i8254.frequency: 1193182
75 kern.eventtimer.et.i8254.quality: 100
76 kern.eventtimer.et.RTC.flags: 17
77 kern.eventtimer.et.RTC.frequency: 32768
78 kern.eventtimer.et.RTC.quality: 0
79 kern.eventtimer.et.HPET.flags: 7
80 kern.eventtimer.et.HPET.frequency: 14318180
81 kern.eventtimer.et.HPET.quality: 550
82 .Ed
83 , where:
84 .Bl -tag
85 .It Va kern.eventtimer.et. Ns Ar X Ns Va .flags
86 bitmask, defining event timer capabilities:
87 .Bl -tag -compact
88 .It 1
89 periodic mode supported,
90 .It 2
91 one-shot mode supported,
92 .It 4
93 timer is per-CPU,
94 .It 8
95 timer may stop when CPU goes to sleep state,
96 .It 16
97 timer supports only power-of-2 divisors.
98 .El
99 .It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency
100 timer base frequency,
101 .It Va kern.eventtimer.et. Ns Ar X Ns Va .quality
102 integral value, defining how good is this timer, comparing to others.
103 .El
104 .Pp
105 Timers management code of the kernel chooses one timer from that list.
106 Current choice can be read and affected via
107 .Va kern.eventtimer.timer
108 tunable/sysctl.
109 Several other tunables/sysctls are affecting how exactly this timer is used:
110 .Bl -tag
111 .It Va kern.eventtimer.periodic
112 allows to choose periodic and one-shot operation mode.
113 In periodic mode, periodic interrupts from timer hardware are taken as the
114 only source of time for time events.
115 One-shot mode instead uses currently selected time counter to precisely
116 schedule all needed events and programs event timer to generate interrupt
117 exactly in specified time.
118 Default value depends of chosen timer capabilities, but one-shot mode is
119 preferred, until other is forced by user or hardware.
120 .It Va kern.eventtimer.singlemul
121 in periodic mode specifies how much times higher timer frequency should be,
122 to not strictly alias hardclock() and statclock() events. Default values are
123 1, 2 or 4, depending on configured HZ value.
124 .It Va kern.eventtimer.idletick
125 makes each CPU to receive every timer interrupt independently of whether they
126 busy or not. By default this options is disabled. If chosen timer is per-CPU
127 and runs in periodic mode, this option has no effect - all interrupts are
128 always generating.
129 .El
130 .Sh SEE ALSO
131 .Xr attimer 4 ,
132 .Xr atrtc 4 ,
133 .Xr hpet 4