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 2/3] perf test: Fix record tests on Intel Broadwell
Date: Wed, 23 Sep 2026 14:52:54 -0700 [thread overview]
Message-ID: <20260923215255.3329181-2-namhyung@kernel.org> (raw)
In-Reply-To: <20260923215255.3329181-1-namhyung@kernel.org>
I noticed it failed for leader sampling tests on Broadwell. It's
because the period of groups members are a little bit different. Maybe
there's an hardware issue but anyway it's close enough to treat them as
same. I printed the value like below.
$ perf test record
...
prev: 462507, curr: 462506
prev: 494783, curr: 494782
prev: 454350, curr: 454349
prev: 502782, curr: 502781
prev: 566693, curr: 566692
prev: 606558, curr: 606557
prev: 559770, curr: 559769
prev: 595737, curr: 595736
prev: 643386, curr: 643385
prev: 663672, curr: 663671
prev: 620622, curr: 620621
prev: 650419, curr: 650418
Leader sampling [Failed inconsistent cycles count]
Let's update the logic to compare values to allow 1% of errors.
Also I think it should compare only if sees the non-leader samples so
split the check of (($index % 2)).
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/shell/record.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index cf8ba3d3411b0bcc..04df35b30b0c15fd 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -550,11 +550,14 @@ test_leader_sampling() {
while IFS= read -r line
do
cycles=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i=="cycles:") print $(i-1)}')
- if [ $(($index%2)) -ne 0 ] && [ ${cycles}x != ${prev_cycles}x ]
+ if [ $(($index%2)) -ne 0 ]
then
- invalid_counts=$(($invalid_counts+1))
- else
- valid_counts=$(($valid_counts+1))
+ if (( $(bc <<< "scale=4; r = ${cycles} / ${prev_cycles}; r >= 0.99 && r <= 1.01") ))
+ then
+ valid_counts=$(($valid_counts+1))
+ else
+ invalid_counts=$(($invalid_counts+1))
+ fi
fi
index=$(($index+1))
prev_cycles=$cycles
--
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 ` Namhyung Kim [this message]
2026-09-24 3:45 ` [PATCH 2/3] perf test: Fix record tests on Intel Broadwell Ian Rogers
2026-09-24 6:55 ` Mi, Dapeng
2026-09-23 21:52 ` [PATCH 3/3] perf test: Fix record tests on hybrid machines Namhyung Kim
2026-09-24 3:44 ` 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-2-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®