From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 3/3] perf test: Fix record tests on hybrid machines
Date: Wed, 23 Sep 2026 14:52:55 -0700 [thread overview]
Message-ID: <20260923215255.3329181-3-namhyung@kernel.org> (raw)
In-Reply-To: <20260923215255.3329181-1-namhyung@kernel.org>
Currently the leader sampling test looks for "cycles:" string to match
the event and retrieve the value before the event name. But it won't
work on hybrid systems as the event name is different like below.
$ perf script | grep -m 10 brstack
perf 3322152 1873980.978431: 625379 cpu_atom/cycles/: 558200cc40cf brstack_bench+0x31 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978431: 625379 cpu_atom/cycles/: 558200cc40cf brstack_bench+0x31 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978598: 612177 cpu_atom/cycles/: 558200cc4082 brstack_foo+0x17 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978598: 612177 cpu_atom/cycles/: 558200cc4082 brstack_foo+0x17 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978762: 591859 cpu_atom/cycles/: 558200cc403d brstack_bar+0x0 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978762: 591859 cpu_atom/cycles/: 558200cc403d brstack_bar+0x0 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978948: 628505 cpu_atom/cycles/: 558200cc403e brstack_bar+0x1 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.978948: 628505 cpu_atom/cycles/: 558200cc403e brstack_bar+0x1 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.979146: 669816 cpu_atom/cycles/: 558200cc40e5 brstack_bench+0x47 (/home/namhyung/project/linux/tools/perf/perf)
perf 3322152 1873980.979146: 669816 cpu_atom/cycles/: 558200cc40e5 brstack_bench+0x47 (/home/namhyung/project/linux/tools/perf/perf)
But we can control the output format of perf script using -F option. So
we knows where the period is in the output. To filter by symbol name,
"ip" and "sym" fields are required as well.
$ perf script -F period,ip,sym | grep -m 10 brstack
625379 558200cc40cf brstack_bench
625379 558200cc40cf brstack_bench
612177 558200cc4082 brstack_foo
612177 558200cc4082 brstack_foo
591859 558200cc403d brstack_bar
591859 558200cc403d brstack_bar
628505 558200cc403e brstack_bar
628505 558200cc403e brstack_bar
669816 558200cc40e5 brstack_bench
669816 558200cc40e5 brstack_bench
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/shell/record.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index 04df35b30b0c15fd..fa8d17e389a0116d 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -537,7 +537,7 @@ test_leader_sampling() {
err=1
return
fi
- perf script -i "${perfdata}" | grep brstack > $script_output
+ perf script -i "${perfdata}" -F period,ip,sym | grep brstack > $script_output
# Check if the two instruction counts are equal in each record.
# However, the throttling code doesn't consider event grouping. During throttling, only the
# leader is stopped, causing the slave's counts significantly higher. To temporarily solve this,
@@ -549,7 +549,7 @@ test_leader_sampling() {
tolerance_rate=0.8
while IFS= read -r line
do
- cycles=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="cycles:") print $(i-1)}')
+ cycles=$(echo $line | awk '{ print $1 }')
if [ $(($index%2)) -ne 0 ]
then
if (( $(bc <<< "scale=4; r = ${cycles} / ${prev_cycles}; r >= 0.99 && r <= 1.01") ))
--
2.56.0.rc1.310.g51773c2048-goog
next prev parent reply other threads:[~2026-09-23 21:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 21:52 [PATCH 1/3] perf test: Fix errors when deleting data in perf record tests Namhyung Kim
2026-09-23 21:52 ` [PATCH 2/3] perf test: Fix record tests on Intel Broadwell Namhyung Kim
2026-09-24 3:45 ` Ian Rogers
2026-09-24 6:55 ` Mi, Dapeng
2026-09-23 21:52 ` Namhyung Kim [this message]
2026-09-24 3:44 ` [PATCH 3/3] perf test: Fix record tests on hybrid machines Ian Rogers
2026-09-24 3:39 ` [PATCH 1/3] perf test: Fix errors when deleting data in perf record tests Ian Rogers
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=20260923215255.3329181-3-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®