diff options
author | Michael Petlan <mpetlan@redhat.com> | 2020-07-22 15:58:45 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-08-13 09:34:26 -0300 |
commit | 194cb6b50f57676130491341f321394bb16ee624 (patch) | |
tree | fc9738dccacc81f08a5229af20d9172c5c09337f | |
parent | 1beaef29c34154ccdcb3f1ae557f6883eda18840 (diff) | |
download | linux-stable-194cb6b50f57676130491341f321394bb16ee624.tar.gz linux-stable-194cb6b50f57676130491341f321394bb16ee624.tar.bz2 linux-stable-194cb6b50f57676130491341f321394bb16ee624.zip |
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 <mpetlan@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
LPU-Reference: 20200722135845.29958-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 4 |
1 files changed, 2 insertions, 2 deletions
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 |