rtc_wakeup

rtc_wakeup is a small program to measure wakeup jitter of a process that waits for the rtc. It is thus a useful tool to diagnose how suited a kernel is for realtime work.


Get the tarball here:

http://tapas.affenbande.org/rtc_wakeup/

Latest version is 0.0.2. The unversioned tarball is the original first release and thus the oldest.


Latest changes:

  • a small, but important, fix by Esben Nielsen
  • some bugfixes by ingo molnar (thanks a bunch)
  • added a busy wait mode to profile latencies (use -b switch followed by number of seconds like -b 10). be cautious though. locks your machine during the test.
  • the cpu cycles/s measurement was done while not yet running SCHED_FIFO. changed it so the rt priv is aquired beforehand
  • when one or more irq’s were missed, the cycle timestamps for the last wakeup do not get used anymore for neither threshold nor max jitter reporting. It’s kind of pointless to calculate jitter for a period with the fundamental requirement that no irq’s be missed being violated.
  • the output file format (-o) has now this format:
    num_of_irqs_since_last_wakeup cycles_count

    and basically looks like this:

    1 116817809121123
    1 116817810280681
    1 116817811456573
    1 116817812617197
    1 116817813788473
    1 116817814948983
    1 116817816121533


Here’s the README:

this program measures the wakeup times of a process read()'ing from
/dev/rtc (which is set to a periodoc irq) and produces [hopefully]
useful statistics (like jitter).

All output is deferred to a second SCHED_FIFO thread with a lower
prio, so the original timing should not be affected.

If you are using a VP or RP kernel, please make sure your rtc IRQ
is either unthreaded or set to SCHED_FIFO with prio 99

usage:

~/source/my_projects/rtc_wakeup$ ./rtc_wakeup -h
usage: rtc_wakeup [options]
options:
-f freqency(hz) (default 1024)
-p realtime prio (default 90(91))
-n max number of interrupts (default 0: run until stopped)
-t jitter threshold (%) (default 5)
-o history_file (default /dev/null)
-h show help

this program needs to have certain superuser privileges, so
if in doubt, run as root or have the realtime lsm loaded.
kill with ctrl-c or specify a maximum number of interrupts
after which to exit.

the -o option allows to dump the "cycle count" times of the
wakeups. The format is:

number_of_irqs_since_last_wakeup   cycle_count

and looks like this, for example:

1 115792314988472
1 115792316164214
1 115792317321255
1 115792318499255
1 115792319656041
1 115792320832987
1 115792321999356

I suppose this data might be useful for further analysis of the
data, for which a numerical program (gnumeric, gnuplot) is more
suited, use -o /dev/stdout to get the data dumped into the
terminal (not too useful).

if you have questions, suggestion, improvements, bugfixes,
mail me:

florian schmidt (mista.tapas@gmx.net)

this whole package is covered by the GPL2 (see the file LICENSE)
this program uses snippets of code from the rtc example prog in
the linux source tree, from realfeel and from jackd.

i suppose this data might be easily fed into a histogram producing script or something.. 

2 Comments

  1. [...] @ 2:22 pm Thanks to Esben Nielsen for a small (but important) bugfis. Grab it from here No Comments » No comments yet. RSS f [...]

  2. [...] Thanks to Esben Nielsen for a small (but important) bugfix. Grab it from here [...]

Leave a Reply