Cyclictest

From RTwiki
(Difference between revisions)
Jump to: navigation, search
(Add initial description about Cyclictest)
(Documentation)
Line 3: Line 3:
 
== Documentation ==
 
== Documentation ==
  
{{Todo|Add documentation for program}}
+
=== Installation ===
 +
 
 +
Get the latest source tarball, untar into a directory of your choice and run ''make'' in the source directory.
 +
 
 +
You can run the resulting binary from there or install it into a system wide reachable path.
 +
 
 +
=== Run it ===
 +
 
 +
Make sure to be root or use sudo to run cyclictest.
 +
 
 +
Without parameters cyclictest creates one thread with a 1ms interval timer.
 +
 
 +
cyclictest -h provides help text for the various options
 +
 
 +
<table>
 +
<tr><td>-b USEC</td><td>--breaktrace=USEC</td><td>send break trace command when latency > USEC</td></tr>
 +
<tr><td valign=top>-c CLOCK</td><td valign=top>--clock=CLOCK</td><td>select clock <br />
 +
0 = CLOCK_MONOTONIC (default) <br />
 +
1 = CLOCK_REALTIME</td></tr>
 +
<tr><td>-d DIST</td><td>--distance=DIST</td><td>distance of thread intervals in us default=500</td></tr>
 +
<tr><td>-i INTV</td><td>--interval=INTV</td><td>base interval of thread in us default=1000</td></tr>
 +
<tr><td>-l LOOPS</td><td>--loops=LOOPS</td><td>number of loops: default=0(endless)</td></tr>
 +
<tr><td>-n</td><td>--nanosleep</td><td>use clock_nanosleep</td></tr>
 +
<tr><td>-p PRIO</td><td>--prio=PRIO</td><td>priority of highest prio thread</td></tr>
 +
<tr><td>-q</td><td>--quiet</td><td>print only a summary on exit</td></tr>
 +
<tr><td>-r</td><td>--relative</td><td>use relative timer instead of absolute</td></tr>
 +
<tr><td>-s</td><td>--system</td><td>use sys_nanosleep and sys_setitimer</td></tr>
 +
<tr><td>-t NUM</td><td>--threads=NUM</td><td>number of threads: default=1</td></tr>
 +
<tr><td valign=top>-v</td><td valign=top>--verbose</td><td>output values on stdout for statistics<br />
 +
format: n:c:v n=tasknum c=count v=value in us</td></tr>
 +
</table>
 +
 
 +
'''-b''' is a debugging option to control the latency tracer in the realtime preemption patch.
 +
 
 +
It is useful to track down unexpected large latencies on a system. This option does only work with
 +
*CONFIG_PREEMPT_RT=y
 +
*CONFIG_LATENCY_TIMING=y
 +
*CONFIG_LATENCY_TRACE=y
 +
kernel configuration options enabled.
 +
The USEC parameter to the -b option defines a maximum latency value, which is compared against the actual latencies of the test. Once the measured latency is higher than the given maximum, the kernel tracer and cyclictest is stopped. The trace can be read from /proc/latency_trace
 +
 
 +
mybox# cat /proc/latency_trace >trace.log
 +
 
 +
Please be aware that the tracer adds significant overhead to the kernel, so the latencies will be much higher than on a kernel with latency tracing disabled.
 +
 
 +
'''-c CLOCK''' selects the clock, which is used
 +
*0 selects CLOCK_MONOTONIC, which is the monotonic increasing system time. This is the default selection
 +
*1 selects CLOCK_REALTIME, which is the time of day time.
 +
 
 +
CLOCK_REALTIME can be set by settimeofday, while CLOCK_MONOTONIC can not be modified by the user.
 +
 
 +
This option has no influence when the '''-s''' option is given.
 +
 
 +
'''-d DIST''' set the distance of thread intervals in microseconds (default is 500us)
 +
 
 +
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.
 +
 
 +
Interval(thread N) = Interval(thread N-1) + DIST
 +
 
 +
'''-i INTV''' set the base interval of the thread(s) in microseconds (default is 1000us)
 +
 
 +
This sets the interval of the first thread. See also '''-d'''.
 +
 
 +
'''-l LOOPS''' set the number of loops (default = 0(endless))
 +
 
 +
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.
 +
 
 +
'''-n''' use clock_nanosleep instead of posix interval timers
 +
 
 +
Setting this option runs the tests with clock_nanosleep instead of posix interval timers.
 +
 
 +
'''-p PRIO''' set the priority of the first thread
 +
 
 +
The given priority is set to the first test thread. Each further thread gets a lower priority:
 +
 
 +
Priority(Thread N) = Priority(Thread N-1)
 +
 
 +
'''-q''' run the tests quiet and print only a summary on exit
 +
 
 +
Useful for automated tests, where only the summary output needs to be captured
 +
 
 +
'''-r''' use relative timers instead of absolute
 +
 
 +
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.
 +
 
 +
'''-s''' use sys_nanosleep and sys_setitimer instead of posix timers
 +
 
 +
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
 +
 
 +
'''-t NUM''' set the number of test threads (default is 1)
 +
 
 +
Create NUM test threads. See '''-d''', '''-i''' and '''-p''' for further information.
 +
 
 +
'''-v''' output values on stdout for statistics
 +
 
 +
This option is used to gather statistical information about the latency distribution. The output is sent to stdout. The output format is
 +
 
 +
n:c:v
 +
 
 +
where n=task number c=count v=latency value in us
 +
 
 +
Use this option in combination with '''-l'''
 +
 
 +
The [http://www.osadl.org/projects-live-cd.0.html OSADL Realtime LiveCD] project provides a script to plot the latency distribution.
  
 
== Expected Results ==
 
== Expected Results ==

Revision as of 10:13, 7 October 2006

Cyclictest is a high resolution test program, written by User:Tglx

Contents

Documentation

Installation

Get the latest source tarball, untar into a directory of your choice and run make in the source directory.

You can run the resulting binary from there or install it into a system wide reachable path.

Run it

Make sure to be root or use sudo to run cyclictest.

Without parameters cyclictest creates one thread with a 1ms interval timer.

cyclictest -h provides help text for the various options

-b USEC--breaktrace=USECsend break trace command when latency > USEC
-c CLOCK--clock=CLOCKselect clock

0 = CLOCK_MONOTONIC (default)

1 = CLOCK_REALTIME
-d DIST--distance=DISTdistance of thread intervals in us default=500
-i INTV--interval=INTVbase interval of thread in us default=1000
-l LOOPS--loops=LOOPSnumber of loops: default=0(endless)
-n--nanosleepuse clock_nanosleep
-p PRIO--prio=PRIOpriority of highest prio thread
-q--quietprint only a summary on exit
-r--relativeuse relative timer instead of absolute
-s--systemuse sys_nanosleep and sys_setitimer
-t NUM--threads=NUMnumber of threads: default=1
-v--verboseoutput values on stdout for statistics
format: n:c:v n=tasknum c=count v=value in us

-b is a debugging option to control the latency tracer in the realtime preemption patch.

It is useful to track down unexpected large latencies on a system. This option does only work with

  • CONFIG_PREEMPT_RT=y
  • CONFIG_LATENCY_TIMING=y
  • CONFIG_LATENCY_TRACE=y

kernel configuration options enabled. The USEC parameter to the -b option defines a maximum latency value, which is compared against the actual latencies of the test. Once the measured latency is higher than the given maximum, the kernel tracer and cyclictest is stopped. The trace can be read from /proc/latency_trace

mybox# cat /proc/latency_trace >trace.log

Please be aware that the tracer adds significant overhead to the kernel, so the latencies will be much higher than on a kernel with latency tracing disabled.

-c CLOCK selects the clock, which is used

  • 0 selects CLOCK_MONOTONIC, which is the monotonic increasing system time. This is the default selection
  • 1 selects CLOCK_REALTIME, which is the time of day time.

CLOCK_REALTIME can be set by settimeofday, while CLOCK_MONOTONIC can not be modified by the user.

This option has no influence when the -s option is given.

-d DIST set the distance of thread intervals in microseconds (default is 500us)

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.

Interval(thread N) = Interval(thread N-1) + DIST

-i INTV set the base interval of the thread(s) in microseconds (default is 1000us)

This sets the interval of the first thread. See also -d.

-l LOOPS set the number of loops (default = 0(endless))

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.

-n use clock_nanosleep instead of posix interval timers

Setting this option runs the tests with clock_nanosleep instead of posix interval timers.

-p PRIO set the priority of the first thread

The given priority is set to the first test thread. Each further thread gets a lower priority:

Priority(Thread N) = Priority(Thread N-1)

-q run the tests quiet and print only a summary on exit

Useful for automated tests, where only the summary output needs to be captured

-r use relative timers instead of absolute

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.

-s use sys_nanosleep and sys_setitimer instead of posix timers

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

-t NUM set the number of test threads (default is 1)

Create NUM test threads. See -d, -i and -p for further information.

-v output values on stdout for statistics

This option is used to gather statistical information about the latency distribution. The output is sent to stdout. The output format is

n:c:v

where n=task number c=count v=latency value in us

Use this option in combination with -l

The OSADL Realtime LiveCD project provides a script to plot the latency distribution.

Expected Results

TODO
Add representative results on various kernels

External Links

Personal tools