linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/2] trace-cmd: Write saved cmdlines in the trace file at the end of the trace.
Date: Fri, 18 Sep 2020 10:16:03 +0300	[thread overview]
Message-ID: <20200918071603.597501-2-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20200918071603.597501-1-tz.stoyanov@gmail.com>

The "tracing/saved_cmdlines" files contains the PID to command name
mapping. This mapping is used when displaying the trace events. The file
is updatated during the trace, but is saved in the trace.dat file just
before the trace starts. This could lead to missed mapping entries,
appeared during the trace.
The saving of "tracing/saved_cmdlines" into trace.dat file is moved
after the trace completes.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 lib/trace-cmd/trace-output.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 4a9a857d..cd7dcec8 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -917,12 +917,6 @@ create_file_fd(int fd, struct tracecmd_input *ihandle,
 	if (read_ftrace_printk(handle))
 		goto out_free;
 
-	/*
-	 * Save the command lines;
-	 */
-	if (save_tracing_file_data(handle, "saved_cmdlines") < 0)
-		goto out_free;
-
 	return handle;
 
  out_free:
@@ -1215,6 +1209,11 @@ struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, in
 	if (!handle)
 		return NULL;
 
+	/*
+	 * Save the command lines;
+	 */
+	if (save_tracing_file_data(handle, "saved_cmdlines") < 0)
+		goto out_free;
 
 	if (tracecmd_write_cpus(handle, cpus) < 0)
 		goto out_free;
@@ -1351,6 +1350,13 @@ int tracecmd_append_cpu_data(struct tracecmd_output *handle,
 {
 	int ret;
 
+	/*
+	 * Save the command lines;
+	 */
+	ret = save_tracing_file_data(handle, "saved_cmdlines");
+	if (ret)
+		return ret;
+
 	ret = tracecmd_write_cpus(handle, cpus);
 	if (ret)
 		return ret;
-- 
2.26.2


      reply	other threads:[~2020-09-18  7:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18  7:16 [PATCH 1/2] trace-cmd: Change tracefs.h include path Tzvetomir Stoyanov (VMware)
2020-09-18  7:16 ` Tzvetomir Stoyanov (VMware) [this message]

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=20200918071603.597501-2-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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).