1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
<table class="head">
<tr>
<td class="head-ltitle">EVENTTIMERS(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">EVENTTIMERS(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">eventtimers</code> —
<span class="Nd">kernel event timers subsystem</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp">Kernel uses several types of time-related devices, such as: real
time clocks, time counters and event timers. Real time clocks responsible
for tracking real world time, mostly when system is down. Time counters are
responsible for generation of monotonically increasing timestamps for
precise uptime tracking purposes, when system is running. Event timers are
responsible for generating interrupts at specified time or periodically, to
run different time-based events. This page is about the last.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">Kernel uses time-based events for many different purposes:
scheduling, statistics, time keeping, profiling and many other things, based
on <a class="Xr">callout(9)</a> mechanism. These purposes now grouped into
three main callbacks:</p>
<dl class="Bl-tag">
<dt id="hardclock"><a class="permalink" href="#hardclock"><code class="Fn">hardclock</code></a>()</dt>
<dd><a class="Xr">callout(9)</a> and timekeeping events entry. Called with
frequency defined by <var class="Va">hz</var> variable, usually
1000Hz.</dd>
<dt id="statclock"><a class="permalink" href="#statclock"><code class="Fn">statclock</code></a>()</dt>
<dd>statistics and scheduler events entry. Called with frequency about
128Hz.</dd>
<dt id="profclock"><a class="permalink" href="#profclock"><code class="Fn">profclock</code></a>()</dt>
<dd>profiler events entry. When enabled, called with frequency about
8KHz.</dd>
</dl>
<p class="Pp">Different platforms provide different kinds of timer hardware. The
goal of the event timers subsystem is to provide unified way to control that
hardware, and to use it, supplying kernel with all required time-based
events.</p>
<p class="Pp">Each driver implementing event timers, registers them at the
subsystem. It is possible to see the list of present event timers, like
this, via <var class="Va">kern.eventtimer</var> sysctl:</p>
<div class="Bd Pp Li">
<pre>kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0)
kern.eventtimer.et.LAPIC.flags: 15
kern.eventtimer.et.LAPIC.frequency: 0
kern.eventtimer.et.LAPIC.quality: 400
kern.eventtimer.et.i8254.flags: 1
kern.eventtimer.et.i8254.frequency: 1193182
kern.eventtimer.et.i8254.quality: 100
kern.eventtimer.et.RTC.flags: 17
kern.eventtimer.et.RTC.frequency: 32768
kern.eventtimer.et.RTC.quality: 0
kern.eventtimer.et.HPET.flags: 7
kern.eventtimer.et.HPET.frequency: 14318180
kern.eventtimer.et.HPET.quality: 550</pre>
</div>
<p class="Pp">where:</p>
<dl class="Bl-inset">
<dt id="kern.eventtimer.et."><var class="Va">kern.eventtimer.et.</var><var class="Ar">X</var><var class="Va">.flags</var></dt>
<dd>is a bitmask, defining event timer capabilities:
<div class="Bd-indent">
<dl class="Bl-tag Bl-compact">
<dt>1</dt>
<dd>periodic mode supported,</dd>
<dt>2</dt>
<dd>one-shot mode supported,</dd>
<dt>4</dt>
<dd>timer is per-CPU,</dd>
<dt>8</dt>
<dd>timer may stop when CPU goes to sleep state,</dd>
<dt>16</dt>
<dd>timer supports only power-of-2 divisors.</dd>
</dl>
</div>
</dd>
<dt id="kern.eventtimer.et.~2"><var class="Va">kern.eventtimer.et.</var><var class="Ar">X</var><var class="Va">.frequency</var></dt>
<dd>is a timer base frequency,</dd>
<dt id="kern.eventtimer.et.~3"><var class="Va">kern.eventtimer.et.</var><var class="Ar">X</var><var class="Va">.quality</var></dt>
<dd>is an integral value, defining how good is this timer, comparing to
others.</dd>
</dl>
<p class="Pp">Timers management code of the kernel chooses one timer from that
list. Current choice can be read and affected via
<var class="Va">kern.eventtimer.timer</var> tunable/sysctl. Several other
tunables/sysctls are affecting how exactly this timer is used:</p>
<dl class="Bl-inset">
<dt id="kern.eventtimer.periodic"><var class="Va">kern.eventtimer.periodic</var></dt>
<dd>allows to choose periodic and one-shot operation mode. In periodic mode,
periodic interrupts from timer hardware are taken as the only source of
time for time events. One-shot mode instead uses currently selected time
counter to precisely schedule all needed events and programs event timer
to generate interrupt exactly in specified time. Default value depends of
chosen timer capabilities, but one-shot mode is preferred, until other is
forced by user or hardware.</dd>
<dt id="kern.eventtimer.singlemul"><var class="Va">kern.eventtimer.singlemul</var></dt>
<dd>in periodic mode specifies how much times higher timer frequency should
be, to not strictly alias
<a class="permalink" href="#hardclock~2"><code class="Fn" id="hardclock~2">hardclock</code></a>()
and
<a class="permalink" href="#statclock~2"><code class="Fn" id="statclock~2">statclock</code></a>()
events. Default values are 1, 2 or 4, depending on configured HZ
value.</dd>
<dt id="kern.eventtimer.idletick"><var class="Va">kern.eventtimer.idletick</var></dt>
<dd>makes each CPU to receive every timer interrupt independently of whether
they busy or not. By default this options is disabled. If chosen timer is
per-CPU and runs in periodic mode, this option has no effect - all
interrupts are always generating.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">apic(4)</a>, <a class="Xr">atrtc(4)</a>,
<a class="Xr">attimer(4)</a>, <a class="Xr">hpet(4)</a>,
<a class="Xr">timecounters(4)</a>, <a class="Xr">eventtimers(9)</a></p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">March 13, 2012</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|