mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qinxin Xia <xiaqinxin@huawei.com>
To: <namhyung@kernel.org>, <irogers@google.com>,
	<peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<wangyushan12@huawei.com>, <hejunhao3@h-partners.com>,
	<jonathan.cameron@huawei.com>, <xiaqinxin@huawei.com>
Cc: <linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
	<adrian.hunter@intel.com>, <james.clark@linaro.org>,
	<linuxarm@huawei.com>
Subject: [PATCH v2 0/1] perf: Add --pmu-filter option for filtering PMUs
Date: Tue, 10 Mar 2026 12:06:06 +0800	[thread overview]
Message-ID: <20260310040607.1780971-1-xiaqinxin@huawei.com> (raw)

This patch adds a new --pmu-filter option to perf-stat command to allow
filtering events on specific PMUs. This is useful when there are
multiple PMUs with same type (e.g. hisi_sicl2_cpa0 and hisi_sicl0_cpa0).

[root@localhost tmp]# perf stat -M cpa_p0_avg_bw
 Performance counter stats for 'system wide':

    19,417,779,115      hisi_sicl0_cpa0/cpa_cycles/      #     0.00 cpa_p0_avg_bw
                 0      hisi_sicl0_cpa0/cpa_p0_wr_dat/
                 0      hisi_sicl0_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl0_cpa0/cpa_p0_rd_dat_32b/
    19,417,751,103      hisi_sicl10_cpa0/cpa_cycles/     #     0.00 cpa_p0_avg_bw
                 0      hisi_sicl10_cpa0/cpa_p0_wr_dat/
                 0      hisi_sicl10_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl10_cpa0/cpa_p0_rd_dat_32b/
    19,417,730,679      hisi_sicl2_cpa0/cpa_cycles/      #     0.31 cpa_p0_avg_bw
        75,635,749      hisi_sicl2_cpa0/cpa_p0_wr_dat/
        18,520,640      hisi_sicl2_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl2_cpa0/cpa_p0_rd_dat_32b/
    19,417,674,227      hisi_sicl8_cpa0/cpa_cycles/      #     0.00 cpa_p0_avg_bw
                 0      hisi_sicl8_cpa0/cpa_p0_wr_dat/
                 0      hisi_sicl8_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl8_cpa0/cpa_p0_rd_dat_32b/

      19.417734480 seconds time elapsed

[root@localhost tmp]# perf stat --pmu-filter hisi_sicl2_cpa0 -M cpa_p0_avg_bw
 Performance counter stats for 'system wide':

     6,234,093,559      cpa_cycles                       #     0.60 cpa_p0_avg_bw
        50,548,465      cpa_p0_wr_dat
         7,552,182      cpa_p0_rd_dat_64b
                 0      cpa_p0_rd_dat_32b

       6.234139320 seconds time elapsed

wildcard match:
[root@localhost ~]# ./perf stat --pmu-filter hisi_sicl[2,8]_cpa0 -M cpa_p0_avg_bw
 Performance counter stats for 'system wide':

    18,505,025,031      hisi_sicl2_cpa0/cpa_cycles/      #     0.42 cpa_p0_avg_bw
        80,007,944      hisi_sicl2_cpa0/cpa_p0_wr_dat/
        42,014,906      hisi_sicl2_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl2_cpa0/cpa_p0_rd_dat_32b/
    18,504,957,351      hisi_sicl8_cpa0/cpa_cycles/      #     0.00 cpa_p0_avg_bw
                 0      hisi_sicl8_cpa0/cpa_p0_wr_dat/
                 0      hisi_sicl8_cpa0/cpa_p0_rd_dat_64b/
                 0      hisi_sicl8_cpa0/cpa_p0_rd_dat_32b/

      18.504994880 seconds time elapsed

Changes since V1:
- Address the comments from Namhyung, the description of the event filter in commit
  info is omitted, and wildcard matching is supported for pmu-filter.
- Link: https://lore.kernel.org/all/20260225034125.2157622-2-xiaqinxin@huawei.com/

Changes since RFC:
- Address the comments from Ian, replace '--uncorepmu'  with '--pmu-filter'.
- Link: https://lore.kernel.org/linux-perf-users/20260120095058.2778834-1-xiaqinxin@huawei.com/

Qinxin Xia (1):
  perf: Add --pmu-filter option for filtering PMUs

 tools/perf/Documentation/perf-stat.txt |  4 ++++
 tools/perf/builtin-stat.c              | 19 +++++++++++++++++++
 tools/perf/util/metricgroup.c          | 18 +++++++++++++-----
 tools/perf/util/parse-events.c         |  2 +-
 4 files changed, 37 insertions(+), 6 deletions(-)

-- 
2.33.0


             reply	other threads:[~2026-03-10  4:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  4:06 Qinxin Xia [this message]
2026-03-10  4:06 ` [PATCH v2 1/1] " Qinxin Xia
2026-03-12 18:07   ` Namhyung Kim
2026-03-19 10:23     ` Qinxin Xia
2026-03-20 22:56       ` Ian Rogers
2026-03-27  6:40         ` Qinxin Xia
2026-03-27  6:52           ` Ian Rogers
2026-03-27 21:01 ` [PATCH v2 0/1] " Namhyung Kim

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=20260310040607.1780971-1-xiaqinxin@huawei.com \
    --to=xiaqinxin@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hejunhao3@h-partners.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangyushan12@huawei.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

all inboxes | Powered by JetHome®