Skip to content

Commit a4dfce7

Browse files
lenticularis39rostedt
authored andcommitted
rtla/timerlat_top: Stop timerlat tracer on signal
Currently, when either SIGINT from the user or SIGALRM from the duration timer is caught by rtla-timerlat, stop_tracing is set to break out of the main loop. This is not sufficient for cases where the timerlat tracer is producing more data than rtla can consume, since in that case, rtla is looping indefinitely inside tracefs_iterate_raw_events, never reaches the check of stop_tracing and hangs. In addition to setting stop_tracing, also stop the timerlat tracer on received signal (SIGINT or SIGALRM). This will stop new samples so that the existing samples may be processed and tracefs_iterate_raw_events eventually exits. Cc: [email protected] Cc: John Kacur <[email protected]> Cc: Luis Goncalves <[email protected]> Cc: Gabriele Monaco <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: a828cd1 ("rtla: Add timerlat tool and timelart top mode") Signed-off-by: Tomas Glozar <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent c73cab9 commit a4dfce7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,12 @@ static struct osnoise_tool
900900
}
901901

902902
static int stop_tracing;
903+
static struct trace_instance *top_inst = NULL;
903904
static void stop_top(int sig)
904905
{
905906
stop_tracing = 1;
907+
if (top_inst)
908+
trace_instance_stop(top_inst);
906909
}
907910

908911
/*
@@ -950,6 +953,13 @@ int timerlat_top_main(int argc, char *argv[])
950953
}
951954

952955
trace = &top->trace;
956+
/*
957+
* Save trace instance into global variable so that SIGINT can stop
958+
* the timerlat tracer.
959+
* Otherwise, rtla could loop indefinitely when overloaded.
960+
*/
961+
top_inst = trace;
962+
953963

954964
retval = enable_timerlat(trace);
955965
if (retval) {
@@ -1131,7 +1141,7 @@ int timerlat_top_main(int argc, char *argv[])
11311141

11321142
return_value = 0;
11331143

1134-
if (trace_is_off(&top->trace, &record->trace)) {
1144+
if (trace_is_off(&top->trace, &record->trace) && !stop_tracing) {
11351145
printf("rtla timerlat hit stop tracing\n");
11361146

11371147
if (!params->no_aa)

0 commit comments

Comments
 (0)