SUSE Linux Real Time Hardware Testing and Latency
SUSE Linux 16.1 provides integrated real-time capabilities. To confirm that a
server can meet real-time deadlines, measure its latency with the hardware latency
detector and with cyclictest. The hardware latency detector
exposes delays caused by firmware and hardware. The cyclictest
tool adds the scheduling overhead of the operating system to the measurement. This
article explains how to prepare the platform, run both tools on SUSE Linux 16.1 and
interpret the results.
1 Understanding real-time hardware latency testing #
Real-time hardware capabilities require predictable response times within a specified margin. This section explains fundamental real-time concepts and the sources of platform interference. It details how to distinguish hardware-induced delays from the scheduling overhead of the operating system using latency tools. Understanding these concepts helps you isolate low-level firmware bottlenecks before deploying production workloads.
You must distinguish between hardware-induced and operating-system-induced latencies. The hardware latency detector runs independently of the Linux kernel scheduler. It polls the CPU Time Stamp Counter (TSC) to find gaps. These gaps indicate when the hardware or firmware disturbed the CPU.
Conversely, cyclictest measures operating system latencies. It runs
closer to a real computing situation by including operating system overhead in its results.
cyclictest measures a superset of what the hardware latency detector
measures, plus the scheduling and interrupt handling overhead added by the operating system. On
a correctly tuned system, expect cyclictest to report somewhat higher
latencies than the hardware latency detector, because it includes this additional software
overhead. If cyclictest reports latencies that are much higher, for
example, hundreds of microseconds or more where the hardware latency detector reports only a
few microseconds, this points to a source of latency in the operating system rather than in the
hardware. In that case, contact SUSE for support.
2 Installing the real-time kernel #
Before testing latencies, you must activate the real-time capabilities on your system. The kernel-rt package provides the preemption capabilities necessary for real-time operations.
Install the real-time kernel package:
>sudozypper install kernel-rtReboot your system.
Select the
kernel-rtkernel from the boot menu to activate the real-time capabilities.
3 Preparing the hardware platform #
Real-time applications require a hardware foundation configured for minimal latency. This section describes how to configure server BIOS and firmware settings. These adjustments eliminate low-level platform interference before you begin latency testing.
Before you start measuring hardware or operating system latencies, you must optimize your machine settings:
Access your server BIOS or firmware settings.
Disable power-management features that introduce variable latency, since these are common sources of SMIs and scheduling jitter. Menu labels vary by vendor, but look for and disable:
C-states (CPU idle power states)
P-states and frequency scaling (SpeedStep, Cool'n'Quiet or similar)
Turbo Boost or turbo core
Hyper-threading or SMT
Any other SMI-generating power management feature
Reduce memory patrol scrubbing to its lowest available rate or disable it, since scrubbing cycles can introduce firmware-level latency spikes.
4 Evaluating hardware latencies with the hardware latency detector #
The hardware latency detector (hwlatdetect) drives the built-in
hwlat ftrace tracer of the kernel through tracefs,
and identifies system delays introduced directly by platform firmware and hardware,
independent of the operating system scheduler.
Before you run this test, make sure that the platform firmware is optimized as described in
Section 3, “Preparing the hardware platform”, that the system is running the
kernel-rt kernel installed in
Section 2, “Installing the real-time kernel”, and that you are logged in as root
or can run commands with sudo.
hwlatdetect #Start the detector with a specified threshold:
>sudohwlatdetect --threshold=10This command monitors system management interrupts (SMIs) with a minimum latency threshold of 10 microseconds.
Check the measured latencies.
A run against a tuned, real-time-capable system produces output similar to the following:
>sudohwlatdetect --threshold=10 --duration=120hwlatdetect: test duration 120 seconds detector: hwlat parameters: Latency threshold: 10us Sample window: 1000000us Sample width: 500000us Non-sampling period: 500000us Output File: None Starting test test finished Max Latency: 3us Samples recorded: 0 Samples exceeding threshold: 0Max Latencyreports the largest gap observed between the CPU Time Stamp Counter reads, in microseconds.Samples exceeding thresholdcounts how many of those gaps were larger than the value you passed with--threshold.A hardware platform suitable for real-time workloads should report
Samples exceeding threshold: 0over the full test duration, withMax Latencybelow the threshold you set. IfSamples exceeding thresholdis greater than zero, orMax Latencyapproaches or exceeds your threshold, the platform firmware or hardware is introducing delays your application deadline cannot tolerate. Treat this as a hardware or firmware-level failure regardless of whatcyclictestreports later, and use a different hardware platform.
5 Measuring latencies with cyclictest #
This section describes how to measure operating system latencies using the
cyclictest tool. It guides you through installing the test suite
on SUSE Linux 16.1. It also details running the benchmark to generate latency
histogram files.
The cyclictest command is part of the real-time kernel test suite, contained
in the rt-tests RPM package distributed as part of
SUSE Linux 16.1.
Before you run this test, make sure your hardware is configured as described in
Section 3, “Preparing the hardware platform”, and that you are logged in as root or can run
commands with sudo.
Install the
rt-testspackage if it is not already present:>sudozypper install rt-testsDetermine your test parameters from the
cyclictestoptions listed in Section 6, “hwlatdetectandcyclictestcommand-line options”.Start
cyclictest. For example, to run 1000 cycles with a latency histogram tracked up to 1000 microseconds, execute:>sudocyclictest --loops=1000 --histogram=1000By default,
cyclictestwrites the histogram data to standard output after the run. To save it to a file for later analysis instead, redirect the output:>sudocyclictest --loops=1000 --histogram=1000 > histogramAnalyze the recorded minimal, actual, average and maximum latencies.
A typical result on a multi-core system looks like:
cyclictest --loops=1000 --histogram=1000policy: fifo: loadavg: 0.12 0.08 0.03 1/342 4821 T: 0 ( 4822) P:99 I:1000 C: 1000 Min: 4 Act: 6 Avg: 7 Max: 31 T: 1 ( 4823) P:99 I:1500 C: 667 Min: 3 Act: 5 Avg: 6 Max: 24Each line reports one measurement thread (
T:), its process ID, scheduling priority (P:) and interval in microseconds (I:). Four values matter for evaluation:Min,Act(the latency of the most recent cycle),AvgandMax. All four are reported in microseconds by default. Use--nsecif you need nanosecond resolution.Maxis the value to compare against the deadline of your application: it is the single worst-case scheduling latency observed during the run. As a rough order of magnitude, well-tuned real-time systems generally reportMaxvalues in the tens of microseconds. Results climbing into the hundreds of microseconds suggest an unresolved source of interference, and results in the thousands of microseconds indicate the system is not meeting real-time deadlines at all. These figures vary by hardware, workload and kernel configuration. Compare thisMaxvalue against theMax Latencyreported byhwlatdetectin Section 4, “Evaluating hardware latencies with the hardware latency detector”. Per Section 1, “Understanding real-time hardware latency testing”,cyclictestis expected to report somewhat higher latencies, since it includes scheduling and interrupt handling overhead thathwlatdetectdoes not measure.The
Maxvalue fromcyclictestincludes hardware latency plus kernel scheduling overhead. TheMax Latencyvalue fromhwlatdetectdoes not. Socyclictestis expected to report a higher number. The two tools are not measuring the same thing.What matters is the size of the gap. A small gap is normal software overhead. A gap of orders of magnitude points to a real problem in the operating system, not the hardware.
6 hwlatdetect and cyclictest command-line options #
Real-time latency measurement tools support multiple runtime parameters. This section
provides a structured reference table of the command-line options for
hwlatdetect and cyclictest. These parameters help you
customize sampling duration, sample windows and thread execution.
The hwlatdetect and cyclictest commands support several
configuration options to modify their behavior.
hwlatdetect options #| Option | Description |
|---|---|
--duration
| Run the detector logic for the specified duration. |
--threshold
| Specify the TSC gap used to detect an SMI. |
--hardlimit
| Define the failure limit. |
--window
| Specify the size of the sample window. |
--width
| Specify the sampling duration within the window. |
--report
| Specify the output file name of the detector report. |
--debug
| Turn on debug output. |
--quiet
| Turn off information output. |
--watch
| Print sample data to standard output as it arrives. |
cyclictest options #| Option | Description |
|---|---|
--nsec
| Use nanoseconds instead of microseconds for the displayed latency values. |
--loops
| Limit the number of test cycles. By default, the tool runs forever. |
--threads
|
Specify the number of threads. Without a number, cyclictest runs on all
available processors.
|
--affinity
| Pin test threads to the processors with the same thread number. |
--histogram
| Create a histogram with the latency values up to the maximum tracking time. |
7 Next steps #
Completing latency benchmarks is only the first part of system preparation. This section details essential post-testing tasks to optimize your real-time server. It guides you to document your system configuration and perform regular regression testing.
Latency testing is only one step in preparing your system. After completing your measurements, analyze the results and tune your system.
Document your test environment thoroughly. Record the following:
server model
processor details
firmware versions
enabled features
operating system version
running kernel
tool options
workloads
Repeat your latency testing after making significant system changes. Regular retesting helps identify performance regressions before they affect production workloads.
8 For more information #
This section lists external resources and technical documentation for real-time latency analysis. It guides you to relevant command man pages and kernel source documentation. These materials provide deeper insights into platform tuning.
To learn more about real-time latency testing and analysis, refer to the following resources:
For more details on
cyclictestoptions and outputs, see the man pageman 8 cyclictest.For more information on the hardware latency detector and the
hwlatftrace tracer, see https://docs.kernel.org/trace/hwlat_detector.html.
9 Legal Notice #
Copyright© 2006– 2026 SUSE LLC and contributors. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documentation License”.
For SUSE trademarks, see https://www.suse.com/company/legal/. All other third-party trademarks are the property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its affiliates. Asterisks (*) denote third-party trademarks.
All information found in this book has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors, nor the translators shall be held liable for possible errors or the consequences thereof.