@@ -5810,6 +5810,7 @@ void init_top_instance(void)
}
enum {
+ OPT_compression = 237,
OPT_file_ver = 238,
OPT_verbose = 239,
OPT_tsc2nsec = 240,
@@ -6250,6 +6251,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}
};
@@ -6676,6 +6678,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:
if (ctx->curr_cmd != CMD_record && ctx->curr_cmd != CMD_record_agent)
die("--file_version has no effect with the command %s\n",
@@ -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(+)