Skip to content

Commit f9c506f

Browse files
captain5050acmel
authored andcommitted
perf test stat: Avoid hybrid assumption when virtualized
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 <james.clark@linaro.org> Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20241212173354.9860-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 2adbf53 commit f9c506f

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
@@ -187,7 +187,11 @@ test_hybrid() {
187187
# Run default Perf stat
188188
cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/[uH]*| cycles[:uH]* " -c)
189189

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

0 commit comments

Comments
 (0)