Reference

cyclictest(8)

High resolution test program

Name

cyclictest - High resolution test program

Synopsis

cyclictest [-mMNqrRsSuvx] [--default-system] [--latency pm-c-state] [--deepest-idle-state idle-state-num] [-c clock-type] [-d distance-usec] [-i interval-usec] [--secaligned wakeup-usec] [-A alignment-usec] [-t num-threads] [--mainaffinity proc-set] [-a proc-set] [--policy threads-sched-policy] [-p thread-prio] [--priospread] [-b break-usec] [--tracemark] [-D duration-mhd] [-l num-loops] [--dbg_cyclictest] [-o oscope-red] [-f fifo-path] [-h max-latency-usec] [-H max-latency-usec] [--spike trigger-point-usec] [--spike-nodes num-nodes] [--histfile file-path] [--json file-path] [--smi]

cyclictest --help

Options

--help display a usage message and exit.

System-altering options

--default-system

Stop cyclictest from force-tuning the system. Without this option, cyclictest writes a value of 0 to /dev/cpu_dma_latency, which prevents the CPU from entering deep sleep states. While such force-tuning might help at showing lower latency numbers, it obscures the fact that the system may require additional tuning.

--latency=PM_Q0S

power management latency target value. This value is written to /dev/cpu_dma_latency and affects c-states. The default is 0

--deepest-idle-state=n

Reduce exit from idle latency by limiting idle state up to n on used cpus (-1 disables all idle states). Power management is not suppresed on other cpus.

--laptop

Obsolete option. Please use --default-system instead.

Sleep-mechanism clock options

-c, --clock=CLOCK

Select the system clock to be used for calculating the measuring thread's latency. Allowed CLOCK values are:
0 = CLOCK_MONOTONIC (default)
1 = CLOCK_REALTIME
aux0 - aux7
For more information on the Linux implementation of such clocks, check clock_getres(2)

-x, --posix_timers

Use POSIX timers instead of clock_nanosleep.

-s, --system

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 uses the nanosleep syscall and is not restricted to one thread.

-r, --relative

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.

-R, --resolution

Check clock resolution, calling clock_gettime() many times. List of lock_gettime() values will be reported with -X

Thread-waekup timing options

-d, --distance=DIST

Distance of thread intervals in us, default = 500

-i, --interval=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.

--secaligned [USEC]

align thread wakeups to the next full second and apply the optional offset.

-A, --align=USEC

Align thread wakeups to a specific offset in microseconds

SMP-related options

\-S, --smp

Set options for standard testing on SMP systems. Equivalent to using the options: "-t -a" as well keeping any specified priority equal across all threads

-t, --threads[=NUM]

Set the number of test threads (default is 1). Create NUM test threads. If NUM is not specified, NUM is set to the number of available CPUs. See -d, -i and -p for further information.

--mainaffinity=CPUSET

Run the main thread on CPU #N. This only affects the main thread and not the measurement threads

-a, --affinity[=PROC-SET]

Run threads on the set of processors given by PROC-SET. If PROC-SET is not specified, all processors will be used. Threads will be assigned to processors in the set in numeric order, in a round-robin fashion.
The set of processors can be specified as A,B,C, or A-C, or A-B,D-F, and so on*. The ! character can be used to negate a set. For example, !B-D means to use all available CPUs except B through D. The cpu numbers are the same as shown in the processor field in /proc/cpuinfo. See numa(3) for more information on specifying CPU sets. * Support for CPU sets requires libnuma version >= 2. For libnuma v1, PROC-SET, if specified, must be a single CPU number.

Memory options

-m, --mlockall

Lock current and future memory allocations to prevent being paged out

Tracing options

-b, --breaktrace=USEC

Send break trace command when latency > USEC

--tracemark

write a trace mark when -b latency is exceeded.

Test-duration options

-D, --duration=TIME

Specify a length for the test run.
Append 'm', 'h', or 'd' to specify minutes, hours or days.

-l, --loops=LOOPS

Set the number of loops. The default is 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.

Output options

--dbg_cyclictest

Print info userful for debugging cyclictest

-o, --oscope=RED

Oscilloscope mode, reduce verbose output by RED.

-F, --fifo=<path>

Create a named pipe at path and write stats to it

-h, --histogram=US

Dump latency histogram to stdout after the run. US is the max latency time to be be tracked in microseconds. This option runs all threads at the same priority.

-H, --histofall=MAXLATENCYINUS

Same as -h except that an additional histogram column is displayed at the right that contains summary data of all thread histograms. If cyclictest runs a single thread only, the -H option is equivalent to -h.

--spike=<trigger>

record all spikes > trigger

--spike-nodes=[num of nodes]

These are the maximum number of spikes we can record.
The default is 1024 if not specified.

--histfile=<path>

Dump the latency histogram to <path> instead of stdout.

--json=FILENAME

Write final results into FILENAME, JSON formatted.

\-M, --refresh_on_max

Delay updating the screen until a new max latency is hit. (useful for running cyclictest on low-bandwidth connections)

-N, --nsecs

Show results in nanoseconds instead of microseconds, which is the default unit.

-q, --quiet

Print a summary only on exit. Useful for automated tests, where only the summary output needs to be captured.

-u, --unbuffered

force unbuffered output for live processing

-v, --verbose

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 is the task number, c is the count, and v is the latency value in microseconds.

X86 options

\--smi

Enable SMI count/detection on processors with SMI count support.

Example invocation

Testing a realtime system is hardware and workload dependent. With that in mind, below cyclictest example invocation can provide a good start:

cyclictest
   --default-system
   --secaligned
   --interval=250
   --distance=0
   --mlockall
   --smp
   --priority=98
   --histogram=1000
   --histfile=output.txt

See also

numa(3), numactl(8), rtla-timerlat(1)

Authors

cyclictest was written by Thomas Gleixner <[email protected]>.

This manual page was written by Alessio Igor Bogani <[email protected]>, for the Debian project (but may be used by others).
Updated by John Kacur <[email protected]>

History

--align since Debian 8 (Jessie); --dbg_cyclictest since Debian 9 (Stretch); --deepest-idle-state since Arch Linux 2026-11-01; --default-system since Debian 12 (Bookworm); --duration since Debian 9 (Stretch); --fifo since Debian 9 (Stretch); --histfile since Debian 9 (Stretch); --histofall since Debian 7 (Wheezy); --json since Debian 12 (Bookworm); --laptop since Debian 9 (Stretch); --latency since Debian 12 (Bookworm); --mainaffinity since Debian 12 (Bookworm); --posix_timers since Debian 12 (Bookworm); --resolution since Debian 9 (Stretch); --secaligned since Debian 9 (Stretch); --spike since Debian 9 (Stretch); --tracemark since Debian 9 (Stretch); --unbuffered since Debian 9 (Stretch); -A since Debian 8 (Jessie); -D since Debian 9 (Stretch); -F since Debian 9 (Stretch); -H since Debian 7 (Wheezy); -R since Debian 9 (Stretch); -u since Debian 9 (Stretch); -x since Debian 12 (Bookworm).

--context until Debian 11 (Bullseye); --event until Debian 11 (Bullseye); --ftrace until Debian 11 (Bullseye); --irqsoff until Debian 11 (Bullseye); --nanosleep until Debian 11 (Bullseye); --notrace until Debian 11 (Bullseye); --numa until Debian 10 (Buster); --policy until Debian 13 (Trixie); --preemptirqs until Debian 11 (Bullseye); --preemptoff until Debian 11 (Bullseye); --prio until Debian 13 (Trixie); --priospread until Debian 13 (Trixie); --traceopt until Debian 11 (Bullseye); --tracer until Debian 11 (Bullseye); -B until Debian 11 (Bullseye); -C until Debian 11 (Bullseye); -E until Debian 11 (Bullseye); -I until Debian 11 (Bullseye); -O until Debian 11 (Bullseye); -P until Debian 11 (Bullseye); -T until Debian 11 (Bullseye); -U until Debian 10 (Buster); -f until Debian 11 (Bullseye); -n until Debian 11 (Bullseye); -p until Debian 13 (Trixie).