RTLA-TIMERLAT-HIST(1)
π rtla-timerlat-hist π
okay bestie, welcome to the rtla-timerlat-hist page β it lives in the General Commands Manual section of your friendly neighbourhood man setup, and it's all about histograms of the operating system timer latency. yes. we're measuring vibes of the kernel's timer. iconic behavior honestly. π
β¨ NAME β¨
rtla-timerlat-hist β Histograms of the operating system timer latency
π SYNOPSIS π
rtla timerlat hist [OPTIONS] ...
like. that's it. that's the summoning ritual. πͺ
π DESCRIPTION π
so the rtla timerlat tool is basically the bestie-interface for the timerlat tracer. and what does that tracer do? it dispatches a kernel thread per-cpu. every single one of those threads sets a periodic timer so it can wake itself up and then immediately go back to sleep β which is, honestly, such a mood π. and after the wakeup, they collect and generate useful information for the debugging of operating system timer latency. like, they're doing the work so you don't have to. obsessed.
now, the timerlat tracer spills the tea in two different ways:
- it periodically prints the timer latency at the timer IRQ handler and the Thread handler π
- and it also enables the trace of the most relevant information via
osnoise:tracepoints β¨
and here's where rtla timerlat shows up: it sets the options of the timerlat tracer and then collects and displays a summary of the results. main character energy fr fr. π
by default? the collection happens synchronously in kernel space using a dedicated BPF program that gets attached to the timerlat tracer. but β and this is the important part β if either BPF or the osnoise:timerlat_sample tracepoint it attaches to is unavailable, the rtla timerlat tool falls back to using tracefs to process the data asynchronously in user space. so it's giving plan B, but make it functional. π«Ά
and finally, the star of this particular show: rtla timerlat hist displays a histogram of each tracer event occurrence. πβ¨
it uses the periodic information, and heads up bestie β the osnoise: tracepoints are enabled when using the -T option. so if you want those, you gotta ask for them. no cap. π
to be continued, don't go anywhereβ¦ π¦
β¨ OPTIONS β¨
okay bestie, buckle UP, this is the part where rtla timerlat hist lets you customize literally everything π every flag, every default, all of it. no skimming allowed.
-a,--auto usβ turns on automatic trace mode, which is the "just make it work" mode: it flips on a bunch of commonly-used options while you're debugging the system. It's the same as typing-T us -s us -t. oh and btw, by default the timerlat tracer usesFIFO:95for timerlat threads, so this is also equivalent to-P f:95. π«Ά-p,--period usβ sets the timerlat tracer period, measured in microseconds.-i,--irq usβ stops the trace if the IRQ latency goes higher than the argument (in us). like, "we're done here" energy.-T,--thread usβ stops the trace if the Thread latency goes higher than the argument (in us).-s,--stack usβ saves the stack trace at the IRQ if a Thread latency is higher than the argument (in us). receipts, basically πΈ-t,--trace [file]β saves the stopped trace to[file|timerlat_trace.txt]. if you don't hand it a filename it just goes totimerlat_trace.txt, iconic default behavior.--dma-latency usβ sets the/dev/cpu_dma_latencyto us, trying to bound how long the system takes to exit from idle latencies. fun fact:cyclictestsets this value to0by default, so use--dma-latency 0if you want similar results to that.--deepest-idle-state nβ disables idle states higher than n for the cpus that are running timerlat threads, which cuts down on exit-from-idle latencies. if n is-1, ALL idle states get disabled, no cap. and when timerlat exits, the idle state setting gets restored to whatever it was originally before you ran timerlat β so it cleans up after itself, we love that πΈ
heads up bestie: this one requires rtla to be built with libcpupower. no libcpupower, no vibe.
-k,--kernel-threadsβ uses timerlat kernel-space threads, in contrast to-u.-u,--user-threadsβ sets timerlat to run without a workload, and instead dispatches user-space workloads to wait on thetimerlat_fd. once the workload gets awakened, it goes back to sleep again, which adds the measurement for the kernel-to-user and user-to-kernel transitions to the tracer output. and lowkey important:--user-threadswill be used unless the user specifies-k.-U,--user-loadβ sets timerlat to run without a workload, just waiting for the user to dispatch a per-cpu task that waits for a new period on thetracing/osnoise/per_cpu/cpu$ID/timerlat_fd. wanna see an example of user-load code? checklinux/tools/rtla/example/timerlat_load.pyπ--bpf-action bpf-programβ loads a BPF program from an ELF file and executes it whenever a latency threshold gets exceeded. very main character.
The BPF program has to be a valid ELF file that's loadable with libbpf. It must contain a function named action_handler, stored in an ELF section with the tp_ prefix. That prefix is what libbpf uses to set the BPF program type to BPF_PROG_TYPE_TRACEPOINT.
The program receives a struct trace_event_raw_timerlat_sample parameter containing the timerlat sample data.
There's an example in tools/tracing/rtla/example/timerlat_bpf_action.c. That example shows how to build a BPF program that prints latency info using bpf_trace_printk() when a threshold is exceeded. β¨
Note: BPF actions need BPF support to be available. If BPF isn't available or it's disabled, the tool falls back to tracefs mode and BPF actions are not supported. so don't come crying to me π
--stack-format formatβ tweaks the format of the stack trace printed during auto-analysis.
The supported values for format are:
truncateβ print the stack trace up to the first unknown address (this is the default).skipβ skip unknown addresses entirely, bye πfullβ print the entire stack trace, unknown addresses and all.
And for unknown addresses, the raw pointer gets printed.
-A,--aligned usβ aligns the wake-up of timerlat threads to a set offset in microseconds.
The alignment gets applied when the threads wake up at the start of tracing, while the timer for the first cycle is armed. Each thread sets its timer to the wake-up time of the previous thread plus the alignment.
You can use this with any non-negative argument, including zero β and zero aligns the threads so they all wake up at the same time. synchronized slay π
-b,--bucket-size Nβ sets the histogram bucket size (default1).-E,--entries Nβ sets the number of entries of the histogram (default256).--no-headerβ do not print the header.--no-summaryβ do not print the summary.--no-indexβ do not print the index.--with-zerosβ prints zero-only entries. yeah, the empty ones. some people want them π€·ββοΈ-c,--cpus cpu-listβ tells the timerlat hist tracer to run the sample threads on the cpu-list.
By default, the timerlat hist tracer runs the sample threads on all CPUs.
-H,--house-keeping cpu-listβ runs rtla control threads only on the given cpu-list.
If you omit it, rtla will try to auto-migrate its main thread to any CPU that isn't running any workload threads. it just wants its own lil corner π¦
-d,--duration time[s|m|h|d]β sets the duration of the session.-D,--debugβ prints debug info.-e,--event sys:eventβ enables an event in the trace (-t) session. the argument can be a specific event, like-e sched:sched_switch, or all events of a system group, like-e sched. multiple-eare allowed. note that it's only active when-tor-aare set.--filter <filter>β filters the previous-e sys:eventevent with<filter>. for more info about event filtering, see <https://www.kernel.org/doc/html/latest/trace/events.html#event-filtering>.--trigger <trigger>β enables a trace event trigger to the previous-e sys:event. if thehist:trigger gets activated, the output histogram will automatically be saved to a file namedsystem_event_hist.txt. for example, this command:
rtla <command> <mode> -t -e osnoise:irq_noise
--trigger="hist:key=desc,duration/1000:sort=desc,duration/1000:vals=hitcount"
will automatically save the content of the histogram associated to the osnoise:irq_noise event in osnoise_irq_noise_hist.txt.
for more info about event triggers, see <https://www.kernel.org/doc/html/latest/trace/events.html#event-triggers>.
-P,--priority o:prio|r:prio|f:prio|d:runtime:periodβ sets the scheduling parameters for the timerlat hist tracer threads. the format for setting the priority is:o:prioβ useSCHED_OTHERwith prio;r:prioβ useSCHED_RRwith prio;f:prioβ useSCHED_FIFOwith prio;d:runtime[us|ms|s]:period[us|ms|s]β useSCHED_DEADLINEwith runtime and period in nanoseconds.
If it's not set, tracer threads keep their default priority. For rtla user threads, it's set to SCHED_FIFO with priority 95. For kernel threads, go check the osnoise and timerlat tracer documentation for your running kernel version π
-C,--cgroup [cgroup]β sets a cgroup for the tracer's threads. if you pass-Cwithout arguments, the tracer's thread will inherit rtla's cgroup. otherwise, the threads get placed on the cgroup you passed to the option.
If it's not set, the behavior differs depending on workload type: user workloads created by rtla will inherit rtla's cgroup, while kernel workloads get assigned the root cgroup.
--warm-up sβ after starting the workload, lets it run for s seconds before starting to collect data, so the system can warm up. any statistical data generated during warm-up gets discarded. we stretch first, then we measure π--trace-buffer-size kBβ sets the per-cpu trace buffer size in kB for the tracing output.
If it's not set, the default tracefs buffer size is used.
--on-threshold actionβ defines an action to be executed when tracing is stopped on a latency threshold specified by-a/--auto,-i/--irq, or-T/--thread.
You can specify multiple --on-threshold actions, and they'll be executed in the order you provide them. If any action fails, the subsequent actions in the list will not be executed. one goes down, they all go down π
The supported actions are:
trace[,file=<filename>]
Saves trace output, optionally taking a filename. This is an alternative to -t/--trace. Note that unlike -t/--trace, specifying this multiple times will result in the trace being saved multiple times.
signal,num=<sig>,pid=<pid>
Sends a signal to a process. parent might be specified in place of pid to target the parent process of rtla.
shell,command=<command>
Executes a shell command.
continue
Continues tracing after the actions are executed instead of stopping.
Example:
$ rtla timerlat hist -T 20 --on-threshold trace --on-threshold
shell,command="grep ipi_send timerlat_trace.txt" --on-threshold
signal,num=2,pid=parent
This will save a trace with the default filename timerlat_trace.txt, print its lines that contain the text ipi_send on standard output, and send signal 2 (SIGINT) to the parent process.
Performance Considerations:
For time-sensitive actions, it's recommended to run rtla timerlat with BPF support and RT priority. And note that, due to implementational limitations, actions might be delayed up to one second after tracing is stopped if BPF mode isn't available or it's disabled. yeah, one whole second. plan accordingly bestie π
--on-end actionβ defines an action to be executed at the end of tracing.
You can specify multiple --on-end actions, and they'll be executed in the order you provide them. If any action fails, the subsequent actions in the list will not be executed.
See the documentation for --on-threshold for the list of supported actions, with the exception that continue has no effect here.
Example:
$ rtla timerlat hist -d 5s --on-end trace
This runs rtla with the default options, and saves trace output at the end.
-h,--helpβ prints the help menu.--dump-tasksβ prints the task running on all CPUs if stop conditions are met (this depends on!--no-aa).--no-aaβ disables auto-analysis, which reduces rtla timerlat cpu usage.
π EXAMPLE π
okay bestie, here's the whole vibe in action. In the example below, rtla timerlat hist is set to run for 10 minutes, on the cpus 0-4, skipping zero only lines. Also, rtla timerlat hist will change the priority of the timerlat threads to run under SCHED_DEADLINE priority, with a 100us runtime every 1ms period. That 1ms period is also passed to the timerlat tracer. Auto-analysis is disabled to reduce overhead.
[root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1000 --no-aa
# RTLA timerlat histogram
# Time unit is microseconds (us)
# Duration: 0 00:10:00
Index IRQ-000 Thr-000 IRQ-001 Thr-001 IRQ-002 Thr-002 IRQ-003 Thr-003 IRQ-004 Thr-004
0 276489 0 206089 0 466018 0 481102 0 205546 0
1 318327 35487 388149 30024 94531 48382 83082 71078 388026 55730
2 3282 122584 4019 126527 28231 109012 23311 89309 4568 98739
3 940 11815 837 9863 6209 16227 6895 17196 910 9780
4 444 17287 424 11574 2097 38443 2169 36736 462 13476
5 206 43291 255 25581 1223 101908 1304 101137 236 28913
6 132 101501 96 64584 635 213774 757 215471 99 73453
7 74 169347 65 124758 350 57466 441 53639 69 148573
8 53 85183 31 156751 229 9052 306 9026 39 139907
9 22 10387 12 42762 161 2554 225 2689 19 26192
10 13 1898 8 5770 114 1247 128 1405 13 3772
11 9 560 9 924 71 686 76 765 8 713
12 4 256 2 360 50 411 64 474 3 278
13 2 167 2 172 43 256 53 350 4 180
14 1 88 1 116 15 198 42 223 0 115
15 2 63 3 94 11 139 20 150 0 58
16 2 37 0 56 5 78 10 102 0 39
17 0 18 0 28 4 57 8 80 0 15
18 0 8 0 17 2 50 6 56 0 12
19 0 9 0 5 0 19 0 48 0 18
20 0 4 0 8 0 11 2 27 0 4
21 0 2 0 3 1 9 1 18 0 6
22 0 1 0 3 1 7 0 3 0 5
23 0 2 0 4 0 2 0 7 0 2
24 0 2 0 2 1 3 0 3 0 5
25 0 0 0 1 0 1 0 1 0 3
26 0 1 0 0 0 2 0 2 0 0
27 0 0 0 3 0 1 0 0 0 1
28 0 0 0 3 0 0 0 1 0 0
29 0 0 0 2 0 2 0 1 0 3
30 0 1 0 0 0 0 0 0 0 0
31 0 1 0 0 0 0 0 2 0 2
32 0 0 0 1 0 2 0 0 0 0
33 0 0 0 2 0 0 0 0 0 1
34 0 0 0 0 0 0 0 0 0 2
35 0 1 0 1 0 0 0 0 0 1
36 0 1 0 0 0 1 0 1 0 0
37 0 0 0 1 0 0 0 0 0 0
40 0 0 0 0 0 1 0 1 0 0
41 0 0 0 0 0 0 0 0 0 1
42 0 0 0 0 0 0 0 0 0 1
44 0 0 0 0 0 1 0 0 0 0
46 0 0 0 0 0 0 0 1 0 0
47 0 0 0 0 0 0 0 0 0 1
50 0 0 0 0 0 0 0 0 0 1
54 0 0 0 1 0 0 0 0 0 0
58 0 0 0 1 0 0 0 0 0 0
over: 0 0 0 0 0 0 0 0 0 0
count: 600002 600002 600002 600002 600002 600002 600002 600002 600002 600002
min: 0 1 0 1 0 1 0 1 0 1
avg: 0 5 0 5 0 4 0 4 0 5
max: 16 36 15 58 24 44 21 46 13 50
look at those numbers go π she's WORKING.
π SEE ALSO π
rtla-timerlat(1)rtla-timerlat-top(1)- Timerlat tracer <https://docs.kernel.org/trace/timerlat-tracer.html>
β¨ AUTHOR β¨
Written by Daniel Bristot de Oliveira < <bristot@kernel.org> >
periodt, thank you king π
π SIGINT BEHAVIOR π
okay so this part actually matters, bestie, pay attention:
- On the first
SIGINT, RTLA exits after collecting all outstanding samples up to the point of receiving the signal. - When receiving more than one
SIGINT, RTLA discards any outstanding samples, and exits while displaying only samples that have already been processed. - If
SIGINTis received during RTLA cleanup, RTLA exits immediately via the default signal handler.
Note: For the purpose of SIGINT behavior, the expiry of duration specified via the-d/--durationoption is treated as equivalent to receiving aSIGINT. So like, aSIGINTreceived after duration expired but samples have not been processed yet will drop any outstanding samples. no cap.
Also note that when using the timerlat tool in BPF mode, samples are processed in-kernel; RTLA only copies them out to display them to the user. A second SIGINT does not affect in-kernel sample aggregation.
π EXIT STATUS π
0β Passed: the test did not hit the stop tracing condition π1β Error: invalid argument π2β Failed: the test hit the stop tracing condition π129β Help: either user requested help or incorrect option was specified π
π«Ά REPORTING BUGS π«Ά
Report bugs to < <linux-kernel@vger.kernel.org> > and < <linux-trace-devel@vger.kernel.org> >
(fr fr, they want to hear from you, don't be shy)
π LICENSE π
rtla is Free Software licensed under the GNU GPLv2
πΈ COPYING πΈ
Copyright (C) 2021 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
that's the whole page bestie, you made it to the end π¦ and if you ever need to double-check what you just read, it's all filed under RTLA-TIMERLAT-HIST(1) β go be the main character of your own tracing session πβ¨
π¦ where this page comes from
- fedora 43: rtla 7.2.11-100.fc43
- fedora 43: rtla 7.2.14-100.fc43 Β· ((GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0) AND ((GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB) AND 0BSD AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-Clear AND CC0-1.0 AND GFDL-1.1-no-invariants-or-later AND GPL-1.0-or-later AND (GPL-1.0-or-later WITH Linux-syscall-note) AND GPL-2.0-only AND (GPL-2.0-only OR CDDL-1.0) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-only) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-or-later) AND (GPL-2.0-only WITH Linux-syscall-note) AND GPL-2.0-or-later AND (GPL-2.0-or-later OR CC-BY-4.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH Linux-syscall-note) AND ISC AND LGPL-2.0-or-later AND (LGPL-2.0-or-later WITH Linux-syscall-note) AND LGPL-2.1-only AND (LGPL-2.1-only WITH Linux-syscall-note) AND LGPL-2.1-or-later AND (LGPL-2.1-or-later WITH Linux-syscall-note) AND (Linux-OpenIB OR GPL-2.0-only) AND (Linux-OpenIB OR GPL-2.0-only OR BSD-2-Clause) AND Linux-man-pages-copyleft AND MIT AND (MPL-1.1 OR GPL-2.0-only) AND (X11 OR GPL-2.0-only) AND (X11 OR GPL-2.0-or-later) AND Zlib AND (copyleft-next-0.3.1 OR GPL-2.0-or-later)
- fedora 43: rtla 7.2.15-100.fc43 Β· ((GPL-2.0-only WITH Linux-syscall-note) OR CDDL-1.0) AND ((GPL-2.0-only WITH Linux-syscall-note) OR Linux-OpenIB) AND 0BSD AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-Clear AND CC0-1.0 AND GFDL-1.1-no-invariants-or-later AND GPL-1.0-or-later AND (GPL-1.0-or-later WITH Linux-syscall-note) AND GPL-2.0-only AND (GPL-2.0-only OR CDDL-1.0) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-only) AND (GPL-2.0-only OR GFDL-1.2-no-invariants-or-later) AND (GPL-2.0-only WITH Linux-syscall-note) AND GPL-2.0-or-later AND (GPL-2.0-or-later OR CC-BY-4.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH Linux-syscall-note) AND ISC AND LGPL-2.0-or-later AND (LGPL-2.0-or-later WITH Linux-syscall-note) AND LGPL-2.1-only AND (LGPL-2.1-only WITH Linux-syscall-note) AND LGPL-2.1-or-later AND (LGPL-2.1-or-later WITH Linux-syscall-note) AND (Linux-OpenIB OR GPL-2.0-only) AND (Linux-OpenIB OR GPL-2.0-only OR BSD-2-Clause) AND Linux-man-pages-copyleft AND MIT AND (MPL-1.1 OR GPL-2.0-only) AND (X11 OR GPL-2.0-only) AND (X11 OR GPL-2.0-or-later) AND Zlib AND (copyleft-next-0.3.1 OR GPL-2.0-or-later)
- fedora 43: rtla 7.2.9-100.fc43
- π the page's license: GPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms