Skip to contentSkip to conversation

trace-cmd record: Disable all tracing after recording data

PATCH New Steven Rostedt 1 participant 1 message Feb 24, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd record: Disable all tracing after recording data

From: "Steven Rostedt (VMware)" <[email protected]>

The latency tracers (preemptirqsoff, wakeup_rt, etc) just take a snapshot at the end of the tracing, and this is done in the record_data() function. But if "keep" is not set, tracecmd_disable_all_tracing() is called before then. That function will clear the trace output and with it, the snapshot that should be recorded for the latency tracers.

As writing to the trace buffer is already disabled by the call to tracecmd_disable_tracing() above the tracecmd_disable_all_tracing(), there's no reason to disable all tracing before the record_data() is called. Simply move the disable tracing after that, and then the information about the latency tracers snapshot will be stored in the trace.dat file.

---
 tracecmd/trace-record.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tracecmd/trace-record.c +3 -3
index efd96d27..f1a48045 100644
@@ -6363,9 +6363,6 @@ static void record_trace(int argc, char **argv,
 
 	record_stats();
 
-	if (!keep)
-		tracecmd_disable_all_tracing(0);
-
 	if (!latency)
 		wait_threads();
 
@@ -6375,6 +6372,9 @@ static void record_trace(int argc, char **argv,
 	} else
 		print_stats();
 
+	if (!keep)
+		tracecmd_disable_all_tracing(0);
+
 	destroy_stats();
 	finalize_record_trace(ctx);
 }
Signature · 1 line
2.25.4