From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Thomas Richter <tmricht@linux.ibm.com>,
Kan Liang <kan.liang@linux.intel.com>,
Zhengjun Xing <zhengjun.xing@linux.intel.com>,
Kang Minchul <tegongkang@gmail.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] perf list: Avoid a hardcoded cpu PMU name
Date: Tue, 12 Sep 2023 16:18:50 -0300 [thread overview]
Message-ID: <ZQC5mmDtasr5/vDH@kernel.org> (raw)
In-Reply-To: <20230906234416.3472339-1-irogers@google.com>
Em Wed, Sep 06, 2023 at 04:44:15PM -0700, Ian Rogers escreveu:
> Use the first core PMU instead.
>
> On a Raspberry Pi, before:
> ```
> $ perf list
> ...
> cpu/t1=v1[,t2=v2,t3 ...]/modifier [Raw hardware event descriptor]
> [(see 'man perf-list' on how to encode it)]
> ...
> ```
> After:
> ```
>
> $ perf list
> ...
> armv8_cortex_a72/t1=v1[,t2=v2,t3 ...]/modifier [Raw hardware event descriptor]
> [(see 'man perf-list' on how to encode it)]
> ...
> ```
Thanks, applied the two patches.
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/util/print-events.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c
> index a7566edc86a3..b0fc48be623f 100644
> --- a/tools/perf/util/print-events.c
> +++ b/tools/perf/util/print-events.c
> @@ -395,6 +395,8 @@ void print_symbol_events(const struct print_callbacks *print_cb, void *print_sta
> */
> void print_events(const struct print_callbacks *print_cb, void *print_state)
> {
> + char *tmp;
> +
> print_symbol_events(print_cb, print_state, PERF_TYPE_HARDWARE,
> event_symbols_hw, PERF_COUNT_HW_MAX);
> print_symbol_events(print_cb, print_state, PERF_TYPE_SOFTWARE,
> @@ -418,17 +420,21 @@ void print_events(const struct print_callbacks *print_cb, void *print_state)
> /*long_desc=*/NULL,
> /*encoding_desc=*/NULL);
>
> - print_cb->print_event(print_state,
> - /*topic=*/NULL,
> - /*pmu_name=*/NULL,
> - "cpu/t1=v1[,t2=v2,t3 ...]/modifier",
> - /*event_alias=*/NULL,
> - /*scale_unit=*/NULL,
> - /*deprecated=*/false,
> - event_type_descriptors[PERF_TYPE_RAW],
> - "(see 'man perf-list' on how to encode it)",
> - /*long_desc=*/NULL,
> - /*encoding_desc=*/NULL);
> + if (asprintf(&tmp, "%s/t1=v1[,t2=v2,t3 ...]/modifier",
> + perf_pmus__scan_core(/*pmu=*/NULL)->name) > 0) {
> + print_cb->print_event(print_state,
> + /*topic=*/NULL,
> + /*pmu_name=*/NULL,
> + tmp,
> + /*event_alias=*/NULL,
> + /*scale_unit=*/NULL,
> + /*deprecated=*/false,
> + event_type_descriptors[PERF_TYPE_RAW],
> + "(see 'man perf-list' on how to encode it)",
> + /*long_desc=*/NULL,
> + /*encoding_desc=*/NULL);
> + free(tmp);
> + }
>
> print_cb->print_event(print_state,
> /*topic=*/NULL,
> --
> 2.42.0.283.g2d96d420d3-goog
>
--
- Arnaldo
prev parent reply other threads:[~2023-09-12 19:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 23:44 [PATCH v1 1/2] perf list: Avoid a hardcoded cpu PMU name Ian Rogers
2023-09-06 23:44 ` [PATCH v1 2/2] perf list pfm: Retry supported test with exclude_kernel Ian Rogers
2023-09-12 19:18 ` Arnaldo Carvalho de Melo [this message]
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=ZQC5mmDtasr5/vDH@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tegongkang@gmail.com \
--cc=tmricht@linux.ibm.com \
--cc=zhengjun.xing@linux.intel.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).