From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 02/10] trace-cmd stream: Do not block when stopping threads
Date: Fri, 6 Jan 2023 13:39:22 -0500 [thread overview]
Message-ID: <20230106183930.12565-3-rostedt@goodmis.org> (raw)
In-Reply-To: <20230106183930.12565-1-rostedt@goodmis.org>
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
When the trace-cmd stream is exiting, it flushes the data. But it does so in
a blocking way, where it can block when there's nothing to read. Set the
timeout of trace_stream_read() to zero in order to return immediately.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
tracecmd/trace-record.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 361524b58772..cc6f27bf22e8 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -798,7 +798,8 @@ static void stop_threads(enum trace_type type)
/* Flush out the pipes */
if (type & TRACE_TYPE_STREAM) {
do {
- ret = trace_stream_read(pids, recorder_threads, NULL);
+ struct timeval tv = { 0, 0 };
+ ret = trace_stream_read(pids, recorder_threads, &tv);
} while (ret > 0);
}
}
--
2.35.1
next prev parent reply other threads:[~2023-01-06 18:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 18:39 [PATCH 00/10] trace-cmd: Fix trace-cmd stream Steven Rostedt
2023-01-06 18:39 ` [PATCH 01/10] trace-cmd library: Set recorder to nonblock when finished Steven Rostedt
2023-01-06 18:39 ` Steven Rostedt [this message]
2023-01-06 18:39 ` [PATCH 03/10] trace-cmd stream: Add a flush signal to kick the output Steven Rostedt
2023-01-06 18:39 ` [PATCH 04/10] trace-cmd stream: Do one last flush when finished Steven Rostedt
2023-01-06 18:39 ` [PATCH 05/10] trace-cmd library: Fix read_data() with error from tracefs_cpu_read() Steven Rostedt
2023-01-06 18:39 ` [PATCH 06/10] trace-cmd: Have trace_stream_read() use poll() Steven Rostedt
2023-01-06 18:39 ` [PATCH 07/10] trace-cmd stream: Set default sleep time to half a second Steven Rostedt
2023-01-06 18:39 ` [PATCH 08/10] trace-cmd library: Return the result of tracefs_cpu_stop() Steven Rostedt
2023-01-06 18:39 ` [PATCH 09/10] trace-cmd record: Set sleep_time to zero at end of recording Steven Rostedt
2023-01-06 18:39 ` [PATCH 10/10] trace-cmd record: Keep stopping the recording when finished Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230106183930.12565-3-rostedt@goodmis.org \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).