diff mbox series

[04/10] trace-cmd stream: Do one last flush when finished

Message ID 20230106183930.12565-5-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit 82b80f66306c35ac492e5a99fa679cfe0cf12d7d
Headers show
Series trace-cmd: Fix trace-cmd stream | expand

Commit Message

Steven Rostedt Jan. 6, 2023, 6:39 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

When trace-cmd stream is finished, the trace_or_sleep() will exit before
waiting for the pipes to flush. Call trace_stream_read() one more time, and
with indefinite blocking, as the pipes should finish everything and then
close (which will stop the polling).

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index a03d334a65d5..83ae8e60d7cb 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -7019,6 +7019,9 @@  static void record_trace(int argc, char **argv,
 		}
 		while (!finished && wait_indefinitely)
 			trace_or_sleep(type, pwait);
+		/* Streams need to be flushed one more time */
+		if (type & TRACE_TYPE_STREAM)
+			trace_stream_read(pids, recorder_threads, NULL);
 	}
 
 	tell_guests_to_stop(ctx);