@@ -1904,10 +1904,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;
@@ -1926,6 +1928,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;
@@ -2014,6 +2023,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;
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(+)