]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man4/eventtimers.4
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man4 / eventtimers.4
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 March 13, 2012
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 -width ".Fn hardclock"
50 .It Fn hardclock
51 .Xr callout 9
52 and timekeeping events entry.
53 Called with frequency defined by
54 .Va hz
55 variable,
56 usually 1000Hz.
57 .It Fn statclock
58 statistics and scheduler events entry.
59 Called with frequency about 128Hz.
60 .It Fn profclock
61 profiler events entry.
62 When enabled, called with frequency about 8KHz.
63 .El
64 .Pp
65 Different platforms provide different kinds of timer hardware.
66 The goal of the event timers subsystem is to provide unified way to control
67 that hardware, and to use it, supplying kernel with all required time-based
68 events.
69 .Pp
70 Each driver implementing event timers, registers them at the subsystem.
71 It is possible to see the list of present event timers, like this, via
72 .Va kern.eventtimer
73 sysctl:
74 .Bd -literal
75 kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0)
76 kern.eventtimer.et.LAPIC.flags: 15
77 kern.eventtimer.et.LAPIC.frequency: 0
78 kern.eventtimer.et.LAPIC.quality: 400
79 kern.eventtimer.et.i8254.flags: 1
80 kern.eventtimer.et.i8254.frequency: 1193182
81 kern.eventtimer.et.i8254.quality: 100
82 kern.eventtimer.et.RTC.flags: 17
83 kern.eventtimer.et.RTC.frequency: 32768
84 kern.eventtimer.et.RTC.quality: 0
85 kern.eventtimer.et.HPET.flags: 7
86 kern.eventtimer.et.HPET.frequency: 14318180
87 kern.eventtimer.et.HPET.quality: 550
88 .Ed
89 .Pp
90 where:
91 .Bl -inset
92 .It Va kern.eventtimer.et. Ns Ar X Ns Va .flags
93 is a
94 bitmask, defining event timer capabilities:
95 .Bl -tag -offset indent -width indent -compact
96 .It 1
97 periodic mode supported,
98 .It 2
99 one-shot mode supported,
100 .It 4
101 timer is per-CPU,
102 .It 8
103 timer may stop when CPU goes to sleep state,
104 .It 16
105 timer supports only power-of-2 divisors.
106 .El
107 .It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency
108 is a
109 timer base frequency,
110 .It Va kern.eventtimer.et. Ns Ar X Ns Va .quality
111 is an
112 integral value, defining how good is this timer, comparing to others.
113 .El
114 .Pp
115 Timers management code of the kernel chooses one timer from that list.
116 Current choice can be read and affected via
117 .Va kern.eventtimer.timer
118 tunable/sysctl.
119 Several other tunables/sysctls are affecting how exactly this timer is used:
120 .Bl -inset
121 .It Va kern.eventtimer.periodic
122 allows to choose periodic and one-shot operation mode.
123 In periodic mode, periodic interrupts from timer hardware are taken as the
124 only source of time for time events.
125 One-shot mode instead uses currently selected time counter to precisely
126 schedule all needed events and programs event timer to generate interrupt
127 exactly in specified time.
128 Default value depends of chosen timer capabilities, but one-shot mode is
129 preferred, until other is forced by user or hardware.
130 .It Va kern.eventtimer.singlemul
131 in periodic mode specifies how much times higher timer frequency should be,
132 to not strictly alias
133 .Fn hardclock
134 and
135 .Fn statclock
136 events.
137 Default values are
138 1, 2 or 4, depending on configured HZ value.
139 .It Va kern.eventtimer.idletick
140 makes each CPU to receive every timer interrupt independently of whether they
141 busy or not.
142 By default this options is disabled.
143 If chosen timer is per-CPU
144 and runs in periodic mode, this option has no effect - all interrupts are
145 always generating.
146 .El
147 .Sh SEE ALSO
148 .Xr apic 4 ,
149 .Xr atrtc 4 ,
150 .Xr attimer 4 ,
151 .Xr hpet 4 ,
152 .Xr timecounters 4 ,
153 .Xr eventtimers 9