linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 10/25] trace-cmd library: Add section header before flyrecord trace data
@ 2021-11-11 15:11 Tzvetomir Stoyanov (VMware)
  2021-11-11 15:11 ` [PATCH v5 11/25] trace-cmd library: Fit CPU latency trace data in the new trace file version 7 format Tzvetomir Stoyanov (VMware)
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-11-11 15:11 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

In trace file version 7, write a section header at the beginning of each
section with flyrecord trace data.

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

diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 1f846742..baa262fb 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -1892,10 +1892,12 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 				int cpus, struct cpu_data_source *data, const char *buff_name)
 {
 	struct data_file_write *data_files = NULL;
+	enum tracecmd_section_flags flags = 0;
 	tsize_t data_offs, offset;
 	unsigned long long endian8;
 	unsigned long long read_size;
 	char *clock;
+	char *str;
 	int ret;
 	int i;
 
@@ -1914,6 +1916,13 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 	if (!HAS_SECTIONS(handle) && do_write_check(handle, "flyrecord", 10))
 		goto out_free;
 
+	if (asprintf(&str, "buffer flyrecord %s", buff_name) < 1)
+		goto out_free;
+	offset = out_write_section_header(handle, TRACECMD_OPTION_BUFFER, str, flags, false);
+	free(str);
+	if (offset == (off_t)-1)
+		goto out_free;
+
 	data_files = calloc(cpus, sizeof(*data_files));
 	if (!data_files)
 		goto out_free;
@@ -2002,6 +2011,9 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
 	if (do_lseek(handle, 0, SEEK_END) == (off64_t)-1)
 		return -1;
 
+	if (out_update_section_header(handle, offset))
+		goto out_free;
+
 	handle->file_state = TRACECMD_FILE_CPU_FLYRECORD;
 
 	return 0;
-- 
2.33.1


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

end of thread, other threads:[~2021-11-24 19:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-11 15:11 [PATCH v5 10/25] trace-cmd library: Add section header before flyrecord trace data Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 11/25] trace-cmd library: Fit CPU latency trace data in the new trace file version 7 format Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 12/25] trace-cmd library: Do not write CPUs with empty trace data Tzvetomir Stoyanov (VMware)
2021-11-24 19:30   ` Steven Rostedt
2021-11-24 19:32     ` Steven Rostedt
2021-11-11 15:11 ` [PATCH v5 13/25] trace-cmd library: Add macro to check file state on reading Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 14/25] trace-cmd library: Introduce sections in trace file reading logic Tzvetomir Stoyanov (VMware)
2021-11-24 19:36   ` Steven Rostedt
2021-11-11 15:11 ` [PATCH v5 15/25] trace-cmd library: Initialize internal sections database on file read Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 16/25] trace-cmd library: Use sections database when reading parts of the trace file Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 17/25] trace-cmd library: Read headers from trace file version 7 Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 18/25] trace-cmd library: Read extended BUFFER option Tzvetomir Stoyanov (VMware)
2021-11-11 15:11 ` [PATCH v5 19/25] trace-cmd library: Handle the extended DONE option Tzvetomir Stoyanov (VMware)

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).