|
Performances |
APIC timer Module for Linux
Documentation Performances of the APIC timer module. Author: Vincent Oberle Purpose This document presents some performance tests in various configurations of the APIC Timer module. Note that this document is partially outdated due to recent changes in the module. Content The bad start problem
The bad start problem Managing the timer list, calling functions, etc. take time and use a lot of cycle. With a brute implementation like:
Moreover, the APIC timer is based on the bus clock, not the processor
clock, but the timers are programmed with a value from the TSC based
on the processor clock. So it is necessary to convert the So without any error management functions, the latency is big (2000 cycles, maybe more, ie a few us). That's why the module implements a mechanism to measure the error of the precedent timer issued and to try to correct the programmation of the next timer. The test shows this mechanism is effective, but since the error correction
uses the precedent timer issued to adjust the programmation of the next one,
the latency of the first timer is always bad.
A simple example This examples creates some timers with With the exception of the bad start problemm the latency stays slow, wiht an
average error < 400 cycles (1 us on a 450 MHz PC)
More timers If a lot of timer are created and added to the timer list,
the module performs well if the With the following example, 30 timers are added to the list,
with an
for (id_cnt = 1; id_cnt < 30; id_cnt++) {
test_create_and_add_timer(id_cnt, 0, id_cnt * 10000, test_fn);
}
and it performs well:
Too much timers... If a lot of timers are created and should be issued in a short amount of time, the modul does not follow and the latency can grow really fast!
for (id_cnt = 1; id_cnt < 30; id_cnt++) {
test_create_and_add_timer(id_cnt, 0, id_cnt * 1000, test_fn);
}
and:
The error is big, even much bigger than shown by the max error field of
/proc/apic_timer (4000 cycles).
How to make/get more tests? All tests are produced by the test scripts in test_apic_timer.c To use one of these test, just use the script iall. For example:
./iall 4 2
to launch the test script number 4 with the output function 2 (use this output
functions to produce graphs).
If you cleaned the kernel messages buffer before with dmesg -c,
you can use the get_datas.pl script to extract the measurements from
the dmesg output,
and build_plots.pl to convert the data in a nice graph (requires gnuplot). |