Skip to content

Commit 55fd403

Browse files
captain5050gregkh
authored andcommitted
perf test stat: Avoid hybrid assumption when virtualized
commit f9c506f upstream. The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this. Fixes: 65d1182 ("perf test: Add a test for default perf stat command") Reviewed-by: James Clark <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e67e3e7 commit 55fd403

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/perf/tests/shell/stat.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ test_hybrid() {
161161
# Run default Perf stat
162162
cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/[uH]*| cycles[:uH]* " -c)
163163

164-
if [ "$pmus" -ne "$cycles_events" ]
164+
# The expectation is that default output will have a cycles events on each
165+
# hybrid PMU. In situations with no cycles PMU events, like virtualized, this
166+
# can fall back to task-clock and so the end count may be 0. Fail if neither
167+
# condition holds.
168+
if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ]
165169
then
166170
echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]"
167171
err=1

0 commit comments

Comments
 (0)