From: Andi Kleen <ak@linux.intel.com>
To: Artem Savkov <asavkov@redhat.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/2] perf script: Fix perf script -F +metric
Date: Fri, 28 Jun 2024 12:19:59 -0700 [thread overview]
Message-ID: <Zn8M39dHtqYpRa0o@tassilo> (raw)
In-Reply-To: <20240626090924.GA56952@alecto.usersys.redhat.com>
> This works, however there seems to be yet another issue on
> perf-tools-next branch that breaks script metrics.
>
> 617824a7f0f73 (perf parse-events: Prefer sysfs/JSON hardware
> events over legacy, 2024-04-15) changes event priority so on
> my host "instructions" have type PERF_TYPE_RAW instead of
> PERF_TYPE_HARDWARE.
FWIW I don't see this on my build on Intel, even with that commit.
> This results in evsel__stat_type no longer recognizing these as
> STAT_INSTRUCTIONS.
I guess we could just fix evsel__stat_type to handle that case
Does this patch work?
perf: Workaround event priority problems
When instructions is not of HARDWARE types anymore, but raw,
which breaks the shadow stat metrics detection for IPC.
Reported-by: Artem Savkov <asavkov@redhat.com>
Fixes: 617824a7f0f73 (perf parse-events: Prefer sysfs/JSON hardware
Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 3466aa952442..87a503e47ff0 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -97,9 +97,11 @@ static enum stat_type evsel__stat_type(const struct evsel *evsel)
if (evsel__is_clock(evsel))
return STAT_NSECS;
- else if (evsel__match(evsel, HARDWARE, HW_CPU_CYCLES))
+ else if (evsel__match(evsel, HARDWARE, HW_CPU_CYCLES) ||
+ !strcmp(evsel__name((struct evsel *)evsel), "cycles"))
return STAT_CYCLES;
- else if (evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS))
+ else if (evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS) ||
+ !strcmp(evsel__name((struct evsel *)evsel), "instructions"))
return STAT_INSTRUCTIONS;
else if (evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_FRONTEND))
return STAT_STALLED_CYCLES_FRONT;
next prev parent reply other threads:[~2024-06-28 19:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 0:42 [PATCH 1/2] perf script: Fix perf script -F +metric Andi Kleen
2024-06-25 0:42 ` [PATCH 2/2] Add a test case for " Andi Kleen
2024-06-27 22:54 ` Namhyung Kim
2024-06-26 9:09 ` [PATCH 1/2] perf script: Fix " Artem Savkov
2024-06-27 22:50 ` Namhyung Kim
2024-06-28 19:19 ` Andi Kleen [this message]
2024-07-01 7:04 ` Artem Savkov
2024-07-01 16:54 ` Andi Kleen
2024-06-27 22:46 ` 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=Zn8M39dHtqYpRa0o@tassilo \
--to=ak@linux.intel.com \
--cc=asavkov@redhat.com \
--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 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).