2 #include <linux/compiler.h> 6 #include <subcmd/parse-options.h> 20 #define for_each_cmd(cmd) \ 21 for (cmd = data_cmds; cmd && cmd->name; cmd++) 30 "perf data [<common options>] <command> [<options>]",
40 printf(
"\tAvailable commands:\n");
50 "perf data convert [<options>]",
56 const char *to_ctf = NULL;
61 const struct option options[] = {
62 OPT_INCR(
'v',
"verbose", &
verbose,
"be more verbose"),
63 OPT_STRING(
'i',
"input", &
input_name,
"file",
"input file name"),
64 #ifdef HAVE_LIBBABELTRACE_SUPPORT 65 OPT_STRING(0,
"to-ctf", &to_ctf, NULL,
"Convert to CTF format"),
67 OPT_BOOLEAN(
'f',
"force", &opts.
force,
"don't complain, do it"),
68 OPT_BOOLEAN(0,
"all", &opts.
all,
"Convert all events"),
72 #ifndef HAVE_LIBBABELTRACE_SUPPORT 73 pr_err(
"No conversion support compiled in. perf should be compiled with environment variables LIBBABELTRACE=1 and LIBBABELTRACE_DIR=/path/to/libbabeltrace/\n");
77 argc = parse_options(argc, argv, options,
85 #ifdef HAVE_LIBBABELTRACE_SUPPORT 88 pr_err(
"The libbabeltrace support is not compiled in.\n");
96 static struct data_cmd data_cmds[] = {
111 PARSE_OPT_STOP_AT_NON_OPTION);
118 if (strcmp(cmd->
name, cmdstr))
121 return cmd->
fn(argc, argv);
124 pr_err(
"Unknown command: %s\n", cmdstr);
static void print_usage(void)
static int cmd_data_convert(int argc, const char **argv)
static const char * data_usage[]
static const char *const data_subcommands[]
static struct data_cmd data_cmds[]
int(* data_cmd_fn_t)(int argc, const char **argv)
int bt_convert__perf2ctf(const char *input, const char *path, struct perf_data_convert_opts *opts)
static const struct option data_options[]
#define for_each_cmd(cmd)
static const char *const data_convert_usage[]
int cmd_data(int argc, const char **argv)