From 194cb6b50f57676130491341f321394bb16ee624 Mon Sep 17 00:00:00 2001 From: Michael Petlan Date: Wed, 22 Jul 2020 15:58:45 +0200 Subject: perf test: Allow multiple probes in record+script_probe_vfs_getname.sh Sometimes when adding a kprobe by perf, it results in multiple probe points, such as the following: # ./perf probe -l probe:vfs_getname (on getname_flags:73@fs/namei.c with pathname) probe:vfs_getname_1 (on getname_flags:73@fs/namei.c with pathname) probe:vfs_getname_2 (on getname_flags:73@fs/namei.c with pathname) # cat /sys/kernel/debug/tracing/kprobe_events p:probe/vfs_getname _text+5501804 pathname=+0(+0(%gpr31)):string p:probe/vfs_getname_1 _text+5505388 pathname=+0(+0(%gpr31)):string p:probe/vfs_getname_2 _text+5508396 pathname=+0(+0(%gpr31)):string In this test, we need to record all of them and expect any of them in the perf-script output, since it's not clear which one will be used for the desired syscall: # perf stat -e probe:vfs_getname\* -- touch /tmp/nic Performance counter stats for 'touch /tmp/nic': 31 probe:vfs_getname_2 0 probe:vfs_getname_1 1 probe:vfs_getname 0.001421826 seconds time elapsed 0.001506000 seconds user 0.000000000 seconds sys If the test relies only on probe:vfs_getname, it might easily miss the relevant data. Signed-off-by: Michael Petlan Cc: Jiri Olsa LPU-Reference: 20200722135845.29958-1-mpetlan@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh index 54030c18bfc2..bf9e729b3ecf 100755 --- a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh +++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh @@ -20,13 +20,13 @@ file=$(mktemp /tmp/temporary_file.XXXXX) record_open_file() { echo "Recording open file:" - perf record -o ${perfdata} -e probe:vfs_getname touch $file + perf record -o ${perfdata} -e probe:vfs_getname\* touch $file } perf_script_filenames() { echo "Looking at perf.data file for vfs_getname records for the file we touched:" perf script -i ${perfdata} | \ - egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname: +\([[:xdigit:]]+\) +pathname=\"${file}\"" + egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname[_0-9]*: +\([[:xdigit:]]+\) +pathname=\"${file}\"" } add_probe_vfs_getname || skip_if_no_debuginfo -- cgit v1.2.3