From: Michael Petlan <mpetlan@redhat.com>
To: linux-perf-users@vger.kernel.org, acme@redhat.com
Cc: jolsa@kernel.org
Subject: [PATCH 2/2] perf: Add external commands to list-cmds
Date: Tue, 5 Apr 2022 00:15:41 +0200 [thread overview]
Message-ID: <20220404221541.30312-2-mpetlan@redhat.com> (raw)
In-Reply-To: <20220404221541.30312-1-mpetlan@redhat.com>
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>
---
tools/perf/perf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 2f6b67189b42..91eb36ec6f1c 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -55,6 +55,7 @@ struct cmd_struct {
};
static struct cmd_struct commands[] = {
+ { "archive", NULL, 0 },
{ "buildid-cache", cmd_buildid_cache, 0 },
{ "buildid-list", cmd_buildid_list, 0 },
{ "config", cmd_config, 0 },
@@ -62,6 +63,7 @@ static struct cmd_struct commands[] = {
{ "diff", cmd_diff, 0 },
{ "evlist", cmd_evlist, 0 },
{ "help", cmd_help, 0 },
+ { "iostat", NULL, 0 },
{ "kallsyms", cmd_kallsyms, 0 },
{ "list", cmd_list, 0 },
{ "record", cmd_record, 0 },
@@ -360,6 +362,8 @@ static void handle_internal_command(int argc, const char **argv)
for (i = 0; i < ARRAY_SIZE(commands); i++) {
struct cmd_struct *p = commands+i;
+ if (p->fn == NULL)
+ continue;
if (strcmp(p->cmd, cmd))
continue;
exit(run_builtin(p, argc, argv));
--
2.18.4
next prev parent reply other threads:[~2022-04-04 22:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 22:15 [PATCH 1/2] perf docs: Add perf-iostat link to manpages Michael Petlan
2022-04-04 22:15 ` Michael Petlan [this message]
2022-04-05 20:54 ` [PATCH 2/2] perf: Add external commands to list-cmds Ian Rogers
2022-04-09 15:38 ` Arnaldo Carvalho de Melo
2022-04-05 20:53 ` [PATCH 1/2] perf docs: Add perf-iostat link to manpages Ian Rogers
2022-04-09 15:39 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220404221541.30312-2-mpetlan@redhat.com \
--to=mpetlan@redhat.com \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.