linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Michael Petlan <mpetlan@redhat.com>,
	linux-perf-users@vger.kernel.org, acme@redhat.com,
	jolsa@kernel.org
Subject: Re: [PATCH 2/2] perf: Add external commands to list-cmds
Date: Sat, 9 Apr 2022 12:38:51 -0300	[thread overview]
Message-ID: <YlGoiyhJRe31yIrp@kernel.org> (raw)
In-Reply-To: <CAP-5=fXo+gU1YwnHdWwk+5WNSOu9=V7WT7VknabwNnz0Lycxjw@mail.gmail.com>

Em Tue, Apr 05, 2022 at 01:54:21PM -0700, Ian Rogers escreveu:
> On Mon, Apr 4, 2022 at 3:59 PM Michael Petlan <mpetlan@redhat.com> wrote:
> >
> > 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>

Thanks, applied.

- Arnaldo

 
> Thanks,
> Ian
> 
> > ---
> >  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
> >

-- 

- Arnaldo

  reply	other threads:[~2022-04-09 15:38 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 ` [PATCH 2/2] perf: Add external commands to list-cmds Michael Petlan
2022-04-05 20:54   ` Ian Rogers
2022-04-09 15:38     ` Arnaldo Carvalho de Melo [this message]
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=YlGoiyhJRe31yIrp@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mpetlan@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).