Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] trace-cmd: Change tracefs.h include path
@ 2020-09-18  7:16 Tzvetomir Stoyanov (VMware)
  2020-09-18  7:16 ` [PATCH 2/2] trace-cmd: Write saved cmdlines in the trace file at the end of the trace Tzvetomir Stoyanov (VMware)
  0 siblings, 1 reply; 2+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-09-18  7:16 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

The tracefs.h file is installed in
	<install_prefix>/include/tracefs/tracefs.h.
However, in trace-cmd.h it is inluded just as "tracefs.h".
When trace-cmd.h is used in trace-cmd build context that include is not
a problem, as all local header paths are described in the Makefiles. But
when other application uses trace-cmd.h and tracefs.h, installed in the
system, the compilation fails due to this broken include.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 include/trace-cmd/trace-cmd.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index f3c95f30..3c2b4745 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -7,6 +7,7 @@
 #define _TRACE_CMD_H
 
 #include "traceevent/event-parse.h"
+#include "tracefs/tracefs.h"
 
 #define TRACECMD_MAGIC { 23, 8, 68 }
 
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] trace-cmd: Write saved cmdlines in the trace file at the end of the trace.
  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)
  0 siblings, 0 replies; 2+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-09-18  7:16 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18  7:16 [PATCH 1/2] trace-cmd: Change tracefs.h include path Tzvetomir Stoyanov (VMware)
2020-09-18  7:16 ` [PATCH 2/2] trace-cmd: Write saved cmdlines in the trace file at the end of the trace Tzvetomir Stoyanov (VMware)

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git