diff options
author | Daniel Bristot de Oliveira <bristot@kernel.org> | 2022-03-02 22:01:37 +0300 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2022-03-15 21:36:50 +0300 |
commit | 28d2160cb1a18cca87a51345e7df47499447f5a4 (patch) | |
tree | 9028b62889a626bc97779b13c9e38603563be773 /tools/tracing/rtla/src/trace.c | |
parent | 761916fd02c2525139aca957b8a53fda1d8b3616 (diff) | |
download | linux-28d2160cb1a18cca87a51345e7df47499447f5a4.tar.xz |
rtla: Check for trace off also in the trace instance
With the addition of --trigger option, it is also possible to stop
the trace from the -t tracing instance using the traceoff trigger.
Make rtla tools to check if the trace is stopped also in the trace
instance, stopping the execution of the tool.
Link: https://lkml.kernel.org/r/59fc7c6f23dddd5c8b7ef1782cf3da51ea2ce0f5.1646247211.git.bristot@kernel.org
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Clark Williams <williams@redhat.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'tools/tracing/rtla/src/trace.c')
-rw-r--r-- | tools/tracing/rtla/src/trace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c index 8249ec4d77cc..5784c9f9e570 100644 --- a/tools/tracing/rtla/src/trace.c +++ b/tools/tracing/rtla/src/trace.c @@ -516,3 +516,22 @@ void trace_events_destroy(struct trace_instance *instance, trace_events_disable(instance, events); trace_events_free(events); } + +int trace_is_off(struct trace_instance *tool, struct trace_instance *trace) +{ + /* + * The tool instance is always present, it is the one used to collect + * data. + */ + if (!tracefs_trace_is_on(tool->inst)) + return 1; + + /* + * The trace instance is only enabled when -t is set. IOW, when the system + * is tracing. + */ + if (trace && !tracefs_trace_is_on(trace->inst)) + return 1; + + return 0; +} |