Skip to content

Commit 3e6b43b

Browse files
rfmvhacmel
authored andcommitted
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: Michael Petlan <mpetlan@redhat.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20220404221541.30312-2-mpetlan@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 0ff26ef commit 3e6b43b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/perf/perf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ struct cmd_struct {
5555
};
5656

5757
static struct cmd_struct commands[] = {
58+
{ "archive", NULL, 0 },
5859
{ "buildid-cache", cmd_buildid_cache, 0 },
5960
{ "buildid-list", cmd_buildid_list, 0 },
6061
{ "config", cmd_config, 0 },
6162
{ "c2c", cmd_c2c, 0 },
6263
{ "diff", cmd_diff, 0 },
6364
{ "evlist", cmd_evlist, 0 },
6465
{ "help", cmd_help, 0 },
66+
{ "iostat", NULL, 0 },
6567
{ "kallsyms", cmd_kallsyms, 0 },
6668
{ "list", cmd_list, 0 },
6769
{ "record", cmd_record, 0 },
@@ -360,6 +362,8 @@ static void handle_internal_command(int argc, const char **argv)
360362

361363
for (i = 0; i < ARRAY_SIZE(commands); i++) {
362364
struct cmd_struct *p = commands+i;
365+
if (p->fn == NULL)
366+
continue;
363367
if (strcmp(p->cmd, cmd))
364368
continue;
365369
exit(run_builtin(p, argc, argv));

0 commit comments

Comments
 (0)