1 Cyclictest is a program to test the performance of high-resolution timers on Linux systems. 2 3 Installation 4 5 Get the latest source tarball, untar into a directory of your choice and run make in the source directory. 6 7 You can run the resulting binary from there or install it. 8 9 Run it 10 11 Make sure to be root or use sudo to run cyclictest. 12 13 Without parameters cyclictest creates one thread with a 1ms interval timer. 14 15 cyclictest -h provides help text for the various options 16 -b USEC --breaktrace=USEC send break trace command when latency > USEC 17 -c CLOCK --clock=CLOCK select clock 18 19 0 = CLOCK_MONOTONIC (default) 20 1 = CLOCK_REALTIME 21 22 -d DIST --distance=DIST distance of thread intervals in us default=500 23 -i INTV --interval=INTV base interval of thread in us default=1000 24 -l LOOPS --loops=LOOPS number of loops: default=0(endless) 25 -n --nanosleep use clock_nanosleep 26 -p PRIO --prio=PRIO priority of highest prio thread 27 -q --quiet print only a summary on exit 28 -r --relative use relative timer instead of absolute 29 -s --system use sys_nanosleep and sys_setitimer 30 -t NUM --threads=NUM number of threads: default=1 31 -v --verbose output values on stdout for statistics 32 33 format: n:c:v n=tasknum c=count v=value in us 34 35 The -b optionis a debugging option to control the latency tracer in the realtime 36 preemption patch. It is useful to track down unexpected large latencies on a system. 37 This option only works with: 38 39 * CONFIG_PREEMPT_RT=y 40 * CONFIG_LATENCY_TIMING=y 41 * CONFIG_LATENCY_TRACE=y 42 43 kernel configuration options enabled. The USEC parameter to the -b option defines 44 a maximum latency value, which is compared against the actual latencies of the test. 45 Once the measured latency is higher than the given maximum, the kernel tracer and 46 cyclictest is stopped. The trace can be read from /proc/latency_trace: 47 48 mybox# cat /proc/latency_trace >trace.log 49 50 Please be aware that the tracer adds significant overhead to the kernel, so the 51 latencies will be much higher than on a kernel with latency tracing disabled. 52 53 Using -c CLOCK selects the clock, which is used 54 55 * 0 selects CLOCK_MONOTONIC, which is the monotonic increasing system time. 56 This is the default selection 57 * 1 selects CLOCK_REALTIME, which is the time of day time. 58 59 CLOCK_REALTIME can be set by settimeofday, while CLOCK_MONOTONIC can not be 60 modified by the user. 61 62 This option has no influence when the -s option is given. 63 64 -d DIST set the distance of thread intervals in microseconds (default is 500us) 65 66 When cylictest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads. 67 68 Interval(thread N) = Interval(thread N-1) + DIST 69 70 -i INTV set the base interval of the thread(s) in microseconds (default is 1000us) 71 72 This sets the interval of the first thread. See also -d. 73 74 -l LOOPS set the number of loops (default = 0(endless)) 75 76 This option is useful for automated tests with a given number of test cycles. cyclictest is stopped once the number of timer intervals has been reached. 77 78 -n use clock_nanosleep instead of posix interval timers 79 80 Setting this option runs the tests with clock_nanosleep instead of posix interval timers. 81 82 -p PRIO set the priority of the first thread 83 84 The given priority is set to the first test thread. Each further thread gets a lower priority: 85 86 Priority(Thread N) = Priority(Thread N-1) 87 88 -q run the tests quiet and print only a summary on exit 89 90 Useful for automated tests, where only the summary output needs to be captured 91 92 -r use relative timers instead of absolute 93 94 The default behaviour of the tests is to use absolute timers. This option is there for completeness and should not be used for reproducible tests. 95 96 -s use sys_nanosleep and sys_setitimer instead of posix timers 97 98 Note, that -s can only be used with one thread because itimers are per process and not per thread. -s in combination with -n uses the nanosleep syscall and is not restricted to one thread 99 100 -t NUM set the number of test threads (default is 1) 101 102 Create NUM test threads. See -d, -i and -p for further information. 103 104 -v output values on stdout for statistics 105 106 This option is used to gather statistical information about the latency distribution. The output is sent to stdout. The output format is 107 108 n:c:v 109 110 where n=task number c=count v=latency value in us 111 112 Use this option in combination with -l 113 114 The OSADL Realtime LiveCD project (http://www.osadl.org/projects-live-cd.0.html) provides a script to plot the latency distribution. 115