Skip to content

Commit 5021d82

Browse files
ahunter6acmel
authored andcommitted
perf test: test_intel_pt.sh: Tidy some perf record options
When not decoding, the options "-B -N --no-bpf-event" speed up perf record. Make a common function for them. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20221014170905.64069-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent e408049 commit 5021d82

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tools/perf/tests/shell/test_intel_pt.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ trap_cleanup()
4242

4343
trap trap_cleanup EXIT TERM INT
4444

45+
# perf record for testing without decoding
46+
perf_record_no_decode()
47+
{
48+
# Options to speed up recording: no post-processing, no build-id cache update,
49+
# and no BPF events.
50+
perf record -B -N --no-bpf-event "$@"
51+
}
52+
4553
have_workload=false
4654
cat << _end_of_file_ | /usr/bin/cc -o "${workload}" -xc - -pthread && have_workload=true
4755
#include <time.h>
@@ -76,7 +84,7 @@ _end_of_file_
7684
can_cpu_wide()
7785
{
7886
echo "Checking for CPU-wide recording on CPU $1"
79-
if ! perf record -o "${tmpfile}" -B -N --no-bpf-event -e dummy:u -C "$1" true >/dev/null 2>&1 ; then
87+
if ! perf_record_no_decode -o "${tmpfile}" -e dummy:u -C "$1" true >/dev/null 2>&1 ; then
8088
echo "No so skipping"
8189
return 2
8290
fi
@@ -93,7 +101,7 @@ test_system_wide_side_band()
93101
can_cpu_wide 1 || return $?
94102

95103
# Record on CPU 0 a task running on CPU 1
96-
perf record -B -N --no-bpf-event -o "${perfdatafile}" -e intel_pt//u -C 0 -- taskset --cpu-list 1 uname
104+
perf_record_no_decode -o "${perfdatafile}" -e intel_pt//u -C 0 -- taskset --cpu-list 1 uname
97105

98106
# Should get MMAP events from CPU 1 because they can be needed to decode
99107
mmap_cnt=$(perf script -i "${perfdatafile}" --no-itrace --show-mmap-events -C 1 2>/dev/null | grep -c MMAP)
@@ -109,7 +117,7 @@ test_system_wide_side_band()
109117

110118
can_kernel()
111119
{
112-
perf record -o "${tmpfile}" -B -N --no-bpf-event -e dummy:k true >/dev/null 2>&1 || return 2
120+
perf_record_no_decode -o "${tmpfile}" -e dummy:k true >/dev/null 2>&1 || return 2
113121
return 0
114122
}
115123

@@ -235,7 +243,7 @@ test_per_thread()
235243
wait_for_threads ${w1} 2
236244
wait_for_threads ${w2} 2
237245

238-
perf record -B -N --no-bpf-event -o "${perfdatafile}" -e intel_pt//u"${k}" -vvv --per-thread -p "${w1},${w2}" 2>"${errfile}" >"${outfile}" &
246+
perf_record_no_decode -o "${perfdatafile}" -e intel_pt//u"${k}" -vvv --per-thread -p "${w1},${w2}" 2>"${errfile}" >"${outfile}" &
239247
ppid=$!
240248
echo "perf PID is $ppid"
241249
wait_for_perf_to_start ${ppid} "${errfile}" || return 1

0 commit comments

Comments
 (0)