Commit 3e6b43be authored by Michael Petlan's avatar Michael Petlan Committed by Arnaldo Carvalho de Melo

perf tools: Add external commands to list-cmds

The `perf --list-cmds` output prints only internal commands, although
there is no reason for that from users' perspective.

Adding the external commands to commands array with NULL function
pointer allows printing all perf commands while not changing the logic
of command handler selection.
Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220404221541.30312-2-mpetlan@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0ff26efe
...@@ -55,6 +55,7 @@ struct cmd_struct { ...@@ -55,6 +55,7 @@ struct cmd_struct {
}; };
static struct cmd_struct commands[] = { static struct cmd_struct commands[] = {
{ "archive", NULL, 0 },
{ "buildid-cache", cmd_buildid_cache, 0 }, { "buildid-cache", cmd_buildid_cache, 0 },
{ "buildid-list", cmd_buildid_list, 0 }, { "buildid-list", cmd_buildid_list, 0 },
{ "config", cmd_config, 0 }, { "config", cmd_config, 0 },
...@@ -62,6 +63,7 @@ static struct cmd_struct commands[] = { ...@@ -62,6 +63,7 @@ static struct cmd_struct commands[] = {
{ "diff", cmd_diff, 0 }, { "diff", cmd_diff, 0 },
{ "evlist", cmd_evlist, 0 }, { "evlist", cmd_evlist, 0 },
{ "help", cmd_help, 0 }, { "help", cmd_help, 0 },
{ "iostat", NULL, 0 },
{ "kallsyms", cmd_kallsyms, 0 }, { "kallsyms", cmd_kallsyms, 0 },
{ "list", cmd_list, 0 }, { "list", cmd_list, 0 },
{ "record", cmd_record, 0 }, { "record", cmd_record, 0 },
...@@ -360,6 +362,8 @@ static void handle_internal_command(int argc, const char **argv) ...@@ -360,6 +362,8 @@ static void handle_internal_command(int argc, const char **argv)
for (i = 0; i < ARRAY_SIZE(commands); i++) { for (i = 0; i < ARRAY_SIZE(commands); i++) {
struct cmd_struct *p = commands+i; struct cmd_struct *p = commands+i;
if (p->fn == NULL)
continue;
if (strcmp(p->cmd, cmd)) if (strcmp(p->cmd, cmd))
continue; continue;
exit(run_builtin(p, argc, argv)); exit(run_builtin(p, argc, argv));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment