perf test: Speed up some tests using perf list

On my system, perf list is very slow to print the whole events.  I think
there's a performance issue in SDT and uprobes event listing.  I noticed
this issue while running perf test on x86 but it takes long to check
some CoreSight event which should be skipped quickly.

Anyway, some test uses perf list to check whether the required event is
available before running the test.  The perf list command can take an
argument to specify event class or (glob) pattern.  But glob pattern is
only to suppress output for unmatched ones after checking all events.

In this case, specifying event class is better to reduce the number of
events it checks and to avoid buggy subsystems entirely.

No functional changes intended.

Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Leo Yan <leo.yan@arm.com>
Link: https://lore.kernel.org/r/20241016065654.269994-1-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Namhyung Kim
2024-10-15 23:56:54 -07:00
parent fbc798316b
commit 3662f82f16
9 changed files with 9 additions and 9 deletions

View File

@@ -18,7 +18,7 @@ BIN="$DIR/$TEST"
# If the test tool/binary does not exist and is executable then skip the test
if ! test -x "$BIN"; then exit 2; fi
# If CoreSight is not available, skip the test
perf list cs_etm | grep -q cs_etm || exit 2
perf list pmu | grep -q cs_etm || exit 2
DATD="."
# If the data dir env is set then make the data dir use that instead of ./
if test -n "$PERF_TEST_CORESIGHT_DATADIR"; then

View File

@@ -27,7 +27,7 @@ check() {
exit
fi
if ! perf list | grep -q lock:contention_begin; then
if ! perf list tracepoint | grep -q lock:contention_begin; then
echo "[Skip] No lock contention tracepoints"
err=2
exit

View File

@@ -94,7 +94,7 @@ test_per_thread() {
test_register_capture() {
echo "Register capture test"
if ! perf list | grep -q 'br_inst_retired.near_call'
if ! perf list pmu | grep -q 'br_inst_retired.near_call'
then
echo "Register capture test [Skipped missing event]"
return

View File

@@ -12,7 +12,7 @@
glb_err=0
skip_if_no_cs_etm_event() {
perf list | grep -q 'cs_etm//' && return 0
perf list pmu | grep -q 'cs_etm//' && return 0
# cs_etm event doesn't exist
return 2

View File

@@ -8,7 +8,7 @@
# the script. Test all 3 parts are working correctly by running the script.
skip_if_no_cs_etm_event() {
perf list | grep -q 'cs_etm//' && return 0
perf list pmu | grep -q 'cs_etm//' && return 0
# cs_etm event doesn't exist
return 2

View File

@@ -9,7 +9,7 @@
# German Gomez <german.gomez@arm.com>, 2021
skip_if_no_arm_spe_event() {
perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0
perf list pmu | grep -E -q 'arm_spe_[0-9]+//' && return 0
# arm_spe event doesn't exist
return 2

View File

@@ -5,7 +5,7 @@
# German Gomez <german.gomez@arm.com>, 2022
skip_if_no_arm_spe_event() {
perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0
perf list pmu | grep -E -q 'arm_spe_[0-9]+//' && return 0
return 2
}

View File

@@ -5,7 +5,7 @@
set -e
# Skip if no Intel PT
perf list | grep -q 'intel_pt//' || exit 2
perf list pmu | grep -q 'intel_pt//' || exit 2
shelldir=$(dirname "$0")
# shellcheck source=lib/waiting.sh

View File

@@ -19,7 +19,7 @@ skip_if_no_perf_trace || exit 2
. "$(dirname $0)"/lib/probe_vfs_getname.sh
trace_open_vfs_getname() {
evts="$(echo "$(perf list syscalls:sys_enter_open* 2>/dev/null | grep -E 'open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/')" | sed ':a;N;s:\n:,:g')"
evts="$(echo "$(perf list tracepoint 2>/dev/null | grep -E 'syscalls:sys_enter_open(at)? ' | sed -r 's/.*sys_enter_([a-z]+) +\[.*$/\1/')" | sed ':a;N;s:\n:,:g')"
perf trace -e $evts touch $file 2>&1 | \
grep -E " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch/[0-9]+ open(at)?\((dfd: +CWD, +)?filename: +\"?${file}\"?, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
}