Skip to content

Commit 3662f82

Browse files
committed
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>
1 parent fbc7983 commit 3662f82

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

tools/perf/tests/shell/lib/coresight.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BIN="$DIR/$TEST"
1818
# If the test tool/binary does not exist and is executable then skip the test
1919
if ! test -x "$BIN"; then exit 2; fi
2020
# If CoreSight is not available, skip the test
21-
perf list cs_etm | grep -q cs_etm || exit 2
21+
perf list pmu | grep -q cs_etm || exit 2
2222
DATD="."
2323
# If the data dir env is set then make the data dir use that instead of ./
2424
if test -n "$PERF_TEST_CORESIGHT_DATADIR"; then

tools/perf/tests/shell/lock_contention.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ check() {
2727
exit
2828
fi
2929

30-
if ! perf list | grep -q lock:contention_begin; then
30+
if ! perf list tracepoint | grep -q lock:contention_begin; then
3131
echo "[Skip] No lock contention tracepoints"
3232
err=2
3333
exit

tools/perf/tests/shell/record.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test_per_thread() {
9494

9595
test_register_capture() {
9696
echo "Register capture test"
97-
if ! perf list | grep -q 'br_inst_retired.near_call'
97+
if ! perf list pmu | grep -q 'br_inst_retired.near_call'
9898
then
9999
echo "Register capture test [Skipped missing event]"
100100
return

tools/perf/tests/shell/test_arm_coresight.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
glb_err=0
1313

1414
skip_if_no_cs_etm_event() {
15-
perf list | grep -q 'cs_etm//' && return 0
15+
perf list pmu | grep -q 'cs_etm//' && return 0
1616

1717
# cs_etm event doesn't exist
1818
return 2

tools/perf/tests/shell/test_arm_coresight_disasm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# the script. Test all 3 parts are working correctly by running the script.
99

1010
skip_if_no_cs_etm_event() {
11-
perf list | grep -q 'cs_etm//' && return 0
11+
perf list pmu | grep -q 'cs_etm//' && return 0
1212

1313
# cs_etm event doesn't exist
1414
return 2

tools/perf/tests/shell/test_arm_spe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# German Gomez <german.gomez@arm.com>, 2021
1010

1111
skip_if_no_arm_spe_event() {
12-
perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0
12+
perf list pmu | grep -E -q 'arm_spe_[0-9]+//' && return 0
1313

1414
# arm_spe event doesn't exist
1515
return 2

tools/perf/tests/shell/test_arm_spe_fork.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# German Gomez <german.gomez@arm.com>, 2022
66

77
skip_if_no_arm_spe_event() {
8-
perf list | grep -E -q 'arm_spe_[0-9]+//' && return 0
8+
perf list pmu | grep -E -q 'arm_spe_[0-9]+//' && return 0
99
return 2
1010
}
1111

tools/perf/tests/shell/test_intel_pt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -e
66

77
# Skip if no Intel PT
8-
perf list | grep -q 'intel_pt//' || exit 2
8+
perf list pmu | grep -q 'intel_pt//' || exit 2
99

1010
shelldir=$(dirname "$0")
1111
# shellcheck source=lib/waiting.sh

tools/perf/tests/shell/trace+probe_vfs_getname.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ skip_if_no_perf_trace || exit 2
1919
. "$(dirname $0)"/lib/probe_vfs_getname.sh
2020

2121
trace_open_vfs_getname() {
22-
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')"
22+
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')"
2323
perf trace -e $evts touch $file 2>&1 | \
2424
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]+$"
2525
}

0 commit comments

Comments
 (0)