Trace file version 7 has more flexible design, which allows to write only CPUs with trace data in the file. If a CPU has no recorded trace data, do not put it in the trace file version 7. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- lib/trace-cmd/trace-output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c index 83c3b9e7..87bbcf39 100644 --- a/lib/trace-cmd/trace-output.c +++ b/lib/trace-cmd/trace-output.c @@ -2335,8 +2335,10 @@ int tracecmd_write_cpu_data(struct tracecmd_output *handle, if (i < cpus) ret = -1; - else + else if (size || handle->file_version < 7) /* do not write empty trace buffer in v7 files*/ ret = out_write_cpu_data(handle, cpus, data, buff_name); + else + ret = 0; for (i = 0; i < cpus; i++) { if (data[i].fd >= 0) -- 2.31.1