mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
The rtla timerlat tool is an interface for the timerlat tracer.
The timerlat tracer dispatches a kernel thread per-cpu. These threads set a
periodic timer to wake themselves up and go back to sleep. After the
wakeup, they collect and generate useful information for the debugging of
operating system timer latency.
The timerlat tracer outputs information in two ways. It periodically
prints the timer latency at the timer IRQ handler and the Thread handler.
It also provides information for each noise via the osnoise tracepoints.
The rtla timerlat top mode displays a summary of the periodic output from
the timerlat tracer.
Here is one example of the rtla timerlat tool output:
---------- %< ----------
[root@alien ~]# rtla timerlat top -c 0-3 -d 1m
Timer Latency
0 00:01:00 | IRQ Timer Latency (us) | Thread Timer Latency (us)
CPU COUNT | cur min avg max | cur min avg max
0 #60001 | 0 0 0 3 | 1 1 1 6
1 #60001 | 0 0 0 3 | 2 1 1 5
2 #60001 | 0 0 1 6 | 1 1 2 7
3 #60001 | 0 0 0 7 | 1 1 1 11
---------- >% ----------
Running:
# rtla timerlat --help
# rtla timerlat top --help
provides information about the available options.
Link: https://lkml.kernel.org/r/e95032e20c2b88c962195bf7693bb53c9ebcced8.1639158831.git.bristot@kernel.org
Cc: Tao Zhou <tao.zhou@linux.dev>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: linux-rt-users@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
88 lines
1.6 KiB
C
88 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2021 Red Hat Inc, Daniel Bristot de Oliveira <bristot@kernel.org>
|
|
*/
|
|
|
|
#include <getopt.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "osnoise.h"
|
|
#include "timerlat.h"
|
|
|
|
/*
|
|
* rtla_usage - print rtla usage
|
|
*/
|
|
static void rtla_usage(void)
|
|
{
|
|
int i;
|
|
|
|
static const char *msg[] = {
|
|
"",
|
|
"rtla version " VERSION,
|
|
"",
|
|
" usage: rtla COMMAND ...",
|
|
"",
|
|
" commands:",
|
|
" osnoise - gives information about the operating system noise (osnoise)",
|
|
" timerlat - measures the timer irq and thread latency",
|
|
"",
|
|
NULL,
|
|
};
|
|
|
|
for (i = 0; msg[i]; i++)
|
|
fprintf(stderr, "%s\n", msg[i]);
|
|
exit(1);
|
|
}
|
|
|
|
/*
|
|
* run_command - try to run a rtla tool command
|
|
*
|
|
* It returns 0 if it fails. The tool's main will generally not
|
|
* return as they should call exit().
|
|
*/
|
|
int run_command(int argc, char **argv, int start_position)
|
|
{
|
|
if (strcmp(argv[start_position], "osnoise") == 0) {
|
|
osnoise_main(argc-start_position, &argv[start_position]);
|
|
goto ran;
|
|
} else if (strcmp(argv[start_position], "timerlat") == 0) {
|
|
timerlat_main(argc-start_position, &argv[start_position]);
|
|
goto ran;
|
|
}
|
|
|
|
return 0;
|
|
ran:
|
|
return 1;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int retval;
|
|
|
|
/* is it an alias? */
|
|
retval = run_command(argc, argv, 0);
|
|
if (retval)
|
|
exit(0);
|
|
|
|
if (argc < 2)
|
|
goto usage;
|
|
|
|
if (strcmp(argv[1], "-h") == 0) {
|
|
rtla_usage();
|
|
exit(0);
|
|
} else if (strcmp(argv[1], "--help") == 0) {
|
|
rtla_usage();
|
|
exit(0);
|
|
}
|
|
|
|
retval = run_command(argc, argv, 1);
|
|
if (retval)
|
|
exit(0);
|
|
|
|
usage:
|
|
rtla_usage();
|
|
exit(1);
|
|
}
|