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>
This commit is contained in:
committed by
Steven Rostedt (Google)
parent
761916fd02
commit
28d2160cb1
@@ -848,7 +848,7 @@ int osnoise_hist_main(int argc, char *argv[])
|
|||||||
goto out_hist;
|
goto out_hist;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst))
|
if (trace_is_off(&tool->trace, &record->trace))
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -858,7 +858,7 @@ int osnoise_hist_main(int argc, char *argv[])
|
|||||||
|
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst)) {
|
if (trace_is_off(&tool->trace, &record->trace)) {
|
||||||
printf("rtla timelat hit stop tracing\n");
|
printf("rtla timelat hit stop tracing\n");
|
||||||
if (params->trace_output) {
|
if (params->trace_output) {
|
||||||
printf(" Saving trace to %s\n", params->trace_output);
|
printf(" Saving trace to %s\n", params->trace_output);
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ int osnoise_top_main(int argc, char **argv)
|
|||||||
if (!params->quiet)
|
if (!params->quiet)
|
||||||
osnoise_print_stats(params, tool);
|
osnoise_print_stats(params, tool);
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst))
|
if (trace_is_off(&tool->trace, &record->trace))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} while (!stop_tracing);
|
} while (!stop_tracing);
|
||||||
@@ -638,7 +638,7 @@ int osnoise_top_main(int argc, char **argv)
|
|||||||
|
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst)) {
|
if (trace_is_off(&tool->trace, &record->trace)) {
|
||||||
printf("osnoise hit stop tracing\n");
|
printf("osnoise hit stop tracing\n");
|
||||||
if (params->trace_output) {
|
if (params->trace_output) {
|
||||||
printf(" Saving trace to %s\n", params->trace_output);
|
printf(" Saving trace to %s\n", params->trace_output);
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ int timerlat_hist_main(int argc, char *argv[])
|
|||||||
goto out_hist;
|
goto out_hist;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst))
|
if (trace_is_off(&tool->trace, &record->trace))
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ int timerlat_hist_main(int argc, char *argv[])
|
|||||||
|
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst)) {
|
if (trace_is_off(&tool->trace, &record->trace)) {
|
||||||
printf("rtla timelat hit stop tracing\n");
|
printf("rtla timelat hit stop tracing\n");
|
||||||
if (params->trace_output) {
|
if (params->trace_output) {
|
||||||
printf(" Saving trace to %s\n", params->trace_output);
|
printf(" Saving trace to %s\n", params->trace_output);
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ int timerlat_top_main(int argc, char *argv[])
|
|||||||
if (!params->quiet)
|
if (!params->quiet)
|
||||||
timerlat_print_stats(params, top);
|
timerlat_print_stats(params, top);
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst))
|
if (trace_is_off(&top->trace, &record->trace))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -664,7 +664,7 @@ int timerlat_top_main(int argc, char *argv[])
|
|||||||
|
|
||||||
return_value = 0;
|
return_value = 0;
|
||||||
|
|
||||||
if (!tracefs_trace_is_on(trace->inst)) {
|
if (trace_is_off(&top->trace, &record->trace)) {
|
||||||
printf("rtla timelat hit stop tracing\n");
|
printf("rtla timelat hit stop tracing\n");
|
||||||
if (params->trace_output) {
|
if (params->trace_output) {
|
||||||
printf(" Saving trace to %s\n", params->trace_output);
|
printf(" Saving trace to %s\n", params->trace_output);
|
||||||
|
|||||||
@@ -516,3 +516,22 @@ void trace_events_destroy(struct trace_instance *instance,
|
|||||||
trace_events_disable(instance, events);
|
trace_events_disable(instance, events);
|
||||||
trace_events_free(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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,3 +47,4 @@ int trace_events_enable(struct trace_instance *instance,
|
|||||||
|
|
||||||
int trace_event_add_filter(struct trace_events *event, char *filter);
|
int trace_event_add_filter(struct trace_events *event, char *filter);
|
||||||
int trace_event_add_trigger(struct trace_events *event, char *trigger);
|
int trace_event_add_trigger(struct trace_events *event, char *trigger);
|
||||||
|
int trace_is_off(struct trace_instance *tool, struct trace_instance *trace);
|
||||||
|
|||||||
Reference in New Issue
Block a user