Cyclictest(8)

πŸ’– CYCLICTEST πŸ’–

okay so bestie, welcome to cyclictest(8), straight out of the System Manager's Manual ✨ β€” and ngl, this one is a high resolution test program, which is giving serious main-character energy. It measures latency. It does it in microseconds. It will absolutely humble your system. Let's get into it πŸ’…


🌸 NAME 🌸

cyclictest β€” the 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 β€” show a usage message and dip out. bye bestie πŸ‘‹

✨ System-altering options ✨

careful, these ones touch your actual system.

  • --default-system β€” stops cyclictest from force-tuning your system. Without this, cyclictest writes a value of 0 to /dev/cpu_dma_latency, which stops the CPU from going into deep sleep states. And like… sure, force-tuning might make your latency numbers look cuter, but it's lowkey lying to you β€” it hides the fact that the system might need extra tuning fr fr.
  • --latency=PM_Q0S β€” the power management latency target value. This value gets written to /dev/cpu_dma_latency and it affects c-states. Default is 0.
  • --deepest-idle-state=n β€” reduces exit-from-idle latency by limiting the idle state up to n on the cpus that are actually used (-1 disables all idle states). Heads up though: power management is not suppressed on the other cpus. πŸ‘€
  • --laptop β€” obsolete, bestie. It's giving 2010. Please use --default-system instead. 🫢

πŸ¦‹ Sleep-mechanism clock options πŸ¦‹

  • -c, --clock=CLOCK β€” pick which system clock gets used to calculate the measuring thread's latency. The allowed CLOCK values are:
0 = CLOCK_MONOTONIC (default)
1 = CLOCK_REALTIME
aux0 - aux7

Wanna know more about how Linux does these clocks? Go 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. Real talk: -s can only be used with one thread, because itimers are per process and not per thread. That said, -s uses the nanosleep syscall and that part isn't restricted to one thread. slay.
  • -r, --relative β€” use relative timers instead of absolute ones. Default behaviour of the tests is absolute timers. This option is here purely for completeness and honestly should not be used for reproducible tests. 🚩
  • -R, --resolution β€” check the clock resolution by calling clock_gettime() many, many times. The list of lock_gettime() values gets 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.
  • -S, --smp β€” sets options for standard testing on SMP systems. Equivalent to using the options -t -a, plus it keeps any specified priority equal across all threads. one setting, whole squad aligned πŸ’…
  • -t, --threads[=NUM] β€” set the number of test threads (default is 1). Creates NUM test threads. If NUM isn't specified, NUM is set to the number of available CPUs. See -d, -i and -p for more info. πŸ”₯
  • --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 isn't specified, all processors get used. Threads get assigned to the processors in the set in numeric order, round-robin style. 🎠
    • 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 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 so they don't get paged out. no eviction, no drama 🫢

⭐ Tracing options ⭐

  • -b, --breaktrace=USEC β€” send break trace command when latency > USEC.
  • --tracemark β€” write a trace mark when the -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. Default is 0 (endless 😭). This option is useful for automated tests with a given number of test cycles. cyclictest stops once the number of timer intervals has been reached.

πŸŽ€ Output options πŸŽ€

  • --dbg_cyclictest β€” print info useful 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 the latency histogram to stdout after the run. US is the max latency time to be tracked, in microseconds. This option runs all threads at the same priority.
  • -H, --histofall=MAXLATENCYINUS β€” same as -h, except an extra histogram column shows up on the right with summary data of all thread histograms. If cyclictest runs a single thread only, -H is equivalent to -h. πŸ‘‘
  • --spike=<trigger> β€” record all spikes > trigger.
  • --spike-nodes=[num of nodes] β€” 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 goes 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, the invocation below is a genuinely good place to 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 <tlgx@linuxtronix.de>.

This manual page was written by Alessio Igor Bogani <abogani@texware.it>, for the Debian project (but may be used by others).

Updated by John Kacur <jkacur@redhat.com>.


and that's the whole page bestie πŸ’– it lives in the System Manager's Manual, dated April 22, 2016, and it ate. no cap. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from