mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
perf test: Add test for Intel TPEBS counting mode
Intel TPEBS sampling mode is supported through perf record. The counting mode code uses perf record to capture retire_latency value and use it in metric calculation. This test checks the counting mode code on Intel platforms. Committer testing: root@x1:~# perf test tpebs 123: test Intel TPEBS counting mode : Ok root@x1:~# set -o vi root@x1:~# perf test tpebs 123: test Intel TPEBS counting mode : Ok root@x1:~# perf test -v tpebs 123: test Intel TPEBS counting mode : Ok root@x1:~# perf test -vvv tpebs 123: test Intel TPEBS counting mode: --- start --- test child forked, pid 16603 Testing without --record-tpebs Testing with --record-tpebs ---- end(0) ---- 123: test Intel TPEBS counting mode : Ok root@x1:~# Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Weilin Wang <weilin.wang@intel.com> Acked-by: Ian Rogers <irogers@google.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Samantha Alt <samantha.alt@intel.com> Link: https://lore.kernel.org/r/20240720062102.444578-9-weilin.wang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
169f18fd98
commit
b2738fda24
19
tools/perf/tests/shell/test_stat_intel_tpebs.sh
Executable file
19
tools/perf/tests/shell/test_stat_intel_tpebs.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# test Intel TPEBS counting mode
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
set -e
|
||||
grep -q GenuineIntel /proc/cpuinfo || { echo Skipping non-Intel; exit 2; }
|
||||
|
||||
# Use this event for testing because it should exist in all platforms
|
||||
event=cache-misses:R
|
||||
|
||||
# Without this cmd option, default value or zero is returned
|
||||
echo "Testing without --record-tpebs"
|
||||
result=$(perf stat -e "$event" true 2>&1)
|
||||
[[ "$result" =~ $event ]] || exit 1
|
||||
|
||||
# In platforms that do not support TPEBS, it should execute without error.
|
||||
echo "Testing with --record-tpebs"
|
||||
result=$(perf stat -e "$event" --record-tpebs -a sleep 0.01 2>&1)
|
||||
[[ "$result" =~ "perf record" && "$result" =~ $event ]] || exit 1
|
||||
Reference in New Issue
Block a user