@@ -199,6 +199,7 @@ struct common_record_context {
char *date2ts;
char *user;
const char *clock;
+ const char *compression;
struct tsc_nsec tsc2nsec;
int data_flags;
int tsync_loop_interval;
@@ -3702,6 +3703,14 @@ static struct tracecmd_output *create_net_output(struct common_record_context *c
goto error;
if (tracecmd_output_set_msg(out, msg_handle))
goto error;
+
+ if (ctx->compression) {
+ if (tracecmd_output_set_compression(out, ctx->compression))
+ goto error;
+ } else if (ctx->file_version >= FILE_VERSION_COMPRESSION) {
+ tracecmd_output_set_compression(out, "any");
+ }
+
if (tracecmd_output_write_headers(out, listed_events))
goto error;
@@ -3748,6 +3757,14 @@ setup_connection(struct buffer_instance *instance, struct common_record_context
goto error;
if (tracecmd_output_set_version(network_handle, ctx->file_version))
goto error;
+
+ if (ctx->compression) {
+ if (tracecmd_output_set_compression(network_handle, ctx->compression))
+ goto error;
+ } else if (ctx->file_version >= FILE_VERSION_COMPRESSION) {
+ tracecmd_output_set_compression(network_handle, "any");
+ }
+
if (tracecmd_output_write_headers(network_handle, listed_events))
goto error;
tracecmd_set_quiet(network_handle, quiet);
@@ -4477,6 +4494,14 @@ static struct tracecmd_output *create_output(struct common_record_context *ctx)
goto error;
if (ctx->file_version && tracecmd_output_set_version(out, ctx->file_version))
goto error;
+
+ if (ctx->compression) {
+ if (tracecmd_output_set_compression(out, ctx->compression))
+ goto error;
+ } else if (ctx->file_version >= FILE_VERSION_COMPRESSION) {
+ tracecmd_output_set_compression(out, "any");
+ }
+
if (tracecmd_output_write_headers(out, listed_events))
goto error;
@@ -4511,7 +4536,7 @@ static void record_data(struct common_record_context *ctx)
if (latency) {
handle = tracecmd_create_file_latency(ctx->output, local_cpu_count,
- ctx->file_version, NULL);
+ ctx->file_version, ctx->compression);
tracecmd_set_quiet(handle, quiet);
} else {
if (!local_cpu_count)
As the trace-cmd library supports trace file compression, trace-cmd record command should have a way to configure this functionality. Trace context is extended to hold the compression algorithm, used to compress the file. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/trace-record.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)