Re: [PATCH 3/3] perf list: Add 'pfm' to list libpfm4 events
From: Namhyung Kim
Date: Tue Sep 22 2020 - 18:45:48 EST
HI Ian,
On Wed, Sep 23, 2020 at 5:50 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Tue, Sep 8, 2020 at 10:59 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Print libpfm4 events with 'perf list pfm' command like others.
> > When libpfm4 support is not enabled, it'd print nothing.
> > Also it support glob pattern matching for event name.
> >
> > $ perf list pfm
> >
> > List of pre-defined events (to be used in --pfm-events):
> >
> > ix86arch:
> > UNHALTED_CORE_CYCLES
> > [count core clock cycles whenever the clock signal ...
> > INSTRUCTION_RETIRED
> > [count the number of instructions at retirement. ...
> > ...
> >
> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> >
> > diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
> > index 10ab5e40a34f..167868053fe0 100644
> > --- a/tools/perf/builtin-list.c
> > +++ b/tools/perf/builtin-list.c
> > @@ -14,6 +14,7 @@
> > #include "util/pmu.h"
> > #include "util/debug.h"
> > #include "util/metricgroup.h"
> > +#include "util/pfm.h"
> > #include <subcmd/pager.h>
> > #include <subcmd/parse-options.h>
> > #include <stdio.h>
> > @@ -42,7 +43,7 @@ int cmd_list(int argc, const char **argv)
> > OPT_END()
> > };
> > const char * const list_usage[] = {
> > - "perf list [<options>] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob]",
> > + "perf list [<options>] [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|pfm|event_glob]",
>
> Should this be "#ifdef HAVE_LIBPFM" to avoid advertising pfm events
> when support isn't compiled in?
I thought about that too, but it's a keyword and current code
already handles it to print nothing, so I think it's ok to have.
Thanks
Namhyung