@@ -5803,6 +5803,7 @@ void init_top_instance(void)
}
enum {
+ OPT_compression = 237,
OPT_file_ver = 238,
OPT_verbose = 239,
OPT_tsc2nsec = 240,
@@ -6243,6 +6244,7 @@ static void parse_record_options(int argc,
{"tsc2nsec", no_argument, NULL, OPT_tsc2nsec},
{"poll", no_argument, NULL, OPT_poll},
{"verbose", optional_argument, NULL, OPT_verbose},
+ {"compression", required_argument, NULL, OPT_compression},
{"file-version", required_argument, NULL, OPT_file_ver},
{NULL, 0, NULL, 0}
};
@@ -6669,6 +6671,17 @@ static void parse_record_options(int argc,
cmd_check_die(ctx, CMD_set, *(argv+1), "--poll");
recorder_flags |= TRACECMD_RECORD_POLL;
break;
+ case OPT_compression:
+ cmd_check_die(ctx, CMD_start, *(argv+1), "--compression");
+ cmd_check_die(ctx, CMD_set, *(argv+1), "--compression");
+ cmd_check_die(ctx, CMD_extract, *(argv+1), "--compression");
+ cmd_check_die(ctx, CMD_stream, *(argv+1), "--compression");
+ cmd_check_die(ctx, CMD_profile, *(argv+1), "--compression");
+ if (strcmp(optarg, "any") && strcmp(optarg, "none") &&
+ !tracecmd_compress_is_supported(optarg, NULL))
+ die("Compression algorithm %s is not supported", optarg);
+ ctx->compression = strdup(optarg);
+ break;
case OPT_file_ver:
cmd_check_die(ctx, CMD_start, *(argv+1), "--file_version");
cmd_check_die(ctx, CMD_set, *(argv+1), "--file_version");
@@ -70,6 +70,11 @@ static struct usage_help usage_help[] = {
" at the beginnig and at the end of the trace\n"
" --poll don't block while reading from the trace buffer\n"
" --file-version set the desired trace file version\n"
+ " --compression compress the trace output file, one of these strings can be passed:\n"
+ " any - auto select the best available compression algorithm\n"
+ " none - do not compress the trace file\n"
+ " name - the name of the desired compression algorithms\n"
+ " available algorithms can be listed with trace-cmd list -c\n"
},
{
"set",
A new parameter is added, which can be used to set desired compression the output trace file. "trace-cmd report --compression <compression>" Where the <compression> string can be compression algorithm name, "any" for the best available algorithm or "none" for no compression. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/trace-record.c | 13 +++++++++++++ tracecmd/trace-usage.c | 5 +++++ 2 files changed, 18 insertions(+)