diff options
author | Ian Rogers <irogers@google.com> | 2021-06-17 21:42:16 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-06-18 19:50:05 +0300 |
commit | a49ed2b4e2e5eed0b5082f7f5d36123c0070b9ab (patch) | |
tree | f14553568f015a013c20451be7f2d927cc040b93 /tools/perf/tests | |
parent | 2638fbd351e8cdc3bca266004b6d348063153c3b (diff) | |
download | linux-a49ed2b4e2e5eed0b5082f7f5d36123c0070b9ab.tar.xz |
perf test: Make stat bpf counters test more robust
If the test is run on a hypervisor then the cycles event may not be
counted, skip the test in this situation. Fail the test if cycles are
not counted in the subsequent bpf counter run.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20210617184216.2075588-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rwxr-xr-x | tools/perf/tests/shell/stat_bpf_counters.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/stat_bpf_counters.sh b/tools/perf/tests/shell/stat_bpf_counters.sh index 85eb689fe202..6b156dd85469 100755 --- a/tools/perf/tests/shell/stat_bpf_counters.sh +++ b/tools/perf/tests/shell/stat_bpf_counters.sh @@ -31,7 +31,15 @@ if ! perf stat --bpf-counters true > /dev/null 2>&1; then fi base_cycles=$(perf stat --no-big-num -e cycles -- perf bench sched messaging -g 1 -l 100 -t 2>&1 | awk '/cycles/ {print $1}') +if [ "$base_cycles" == "<not" ]; then + echo "Skipping: cycles event not counted" + exit 2 +fi bpf_cycles=$(perf stat --no-big-num --bpf-counters -e cycles -- perf bench sched messaging -g 1 -l 100 -t 2>&1 | awk '/cycles/ {print $1}') +if [ "$bpf_cycles" == "<not" ]; then + echo "Failed: cycles not counted with --bpf-counters" + exit 1 +fi compare_number $base_cycles $bpf_cycles exit 0 |