Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tests: Make data symbol test wait for perf to start

The perf data symbol test waits 1 second for perf to run and collect data,
which may be too little if perf takes a long time to start up, which has
been noticed on systems with many CPUs. Use existing wait_for_perf_to_start
helper to wait for perf to start.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20231123075848.9652-8-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
3b24b15c fcfb5a61

+9 -2
+9 -2
tools/perf/tests/shell/test_data_symbol.sh
··· 4 4 # SPDX-License-Identifier: GPL-2.0 5 5 # Leo Yan <leo.yan@linaro.org>, 2022 6 6 7 + shelldir=$(dirname "$0") 8 + # shellcheck source=lib/waiting.sh 9 + . "${shelldir}"/lib/waiting.sh 10 + 7 11 skip_if_no_mem_event() { 8 12 perf mem record -e list 2>&1 | grep -E -q 'available' && return 0 9 13 return 2 ··· 17 13 18 14 TEST_PROGRAM="perf test -w datasym" 19 15 PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) 16 + ERR_FILE=$(mktemp /tmp/__perf_test.stderr.XXXXX) 20 17 21 18 check_result() { 22 19 # The memory report format is as below: ··· 55 50 # specific CPU and test in per-CPU mode. 56 51 is_amd=$(grep -E -c 'vendor_id.*AuthenticAMD' /proc/cpuinfo) 57 52 if (($is_amd >= 1)); then 58 - perf mem record -o ${PERF_DATA} -C 0 -- taskset -c 0 $TEST_PROGRAM & 53 + perf mem record -vvv -o ${PERF_DATA} -C 0 -- taskset -c 0 $TEST_PROGRAM 2>"${ERR_FILE}" & 59 54 else 60 - perf mem record --all-user -o ${PERF_DATA} -- $TEST_PROGRAM & 55 + perf mem record -vvv --all-user -o ${PERF_DATA} -- $TEST_PROGRAM 2>"${ERR_FILE}" & 61 56 fi 62 57 63 58 PERFPID=$! 59 + 60 + wait_for_perf_to_start ${PERFPID} "${ERR_FILE}" 64 61 65 62 sleep 1 66 63