@@ -2092,11 +2092,13 @@ struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, in
if (HAS_SECTIONS(handle) &&
!out_add_buffer_option_v7(handle, "", TRACECMD_OPTION_BUFFER_TEXT, offset, 0, NULL))
goto out_free;
+ if (handle->compress)
+ flags |= TRACECMD_SEC_FL_COMPRESS;
offset = out_write_section_header(handle, TRACECMD_OPTION_BUFFER_TEXT,
"buffer latency", flags, false);
- copy_file(handle, path);
+ copy_file_compress(handle, path, NULL);
if (out_update_section_header(handle, offset))
goto out_free;
@@ -2199,6 +2201,8 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
if (!HAS_SECTIONS(handle) && do_write_check(handle, "flyrecord", 10))
goto out_free;
+ if (handle->compress)
+ flags |= TRACECMD_SEC_FL_COMPRESS;
if (asprintf(&str, "buffer flyrecord %s", buff_name) < 1)
goto out_free;
offset = out_write_section_header(handle, TRACECMD_OPTION_BUFFER, str, flags, false);
@@ -2251,14 +2255,15 @@ __hidden int out_write_cpu_data(struct tracecmd_output *handle,
if (data[i].size) {
if (lseek64(data[i].fd, data[i].offset, SEEK_SET) == (off64_t)-1)
goto out_free;
- read_size = copy_file_fd(handle, data[i].fd, data[i].size);
+ read_size = out_copy_fd_compress(handle, data[i].fd,
+ data[i].size, &data_files[i].write_size);
+
if (read_size != data_files[i].file_size) {
errno = EINVAL;
tracecmd_warning("did not match size of %lld to %lld",
read_size, data_files[i].file_size);
goto out_free;
}
- data_files[i].write_size = read_size;
} else {
data_files[i].write_size = 0;
}
If the output file handler supports compression, use it to compress the flyrecord and latency trace data. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- lib/trace-cmd/trace-output.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)