1 # Use vfs_getname probe to get syscall args filenames
3 # Uses the 'perf test shell' library to add probe:vfs_getname to the system
4 # then use it with 'perf record' using 'touch' to write to a temp file, then
5 # checks that that was captured by the vfs_getname probe in the generated
6 # perf.data file, with the temp file name as the pathname argument.
8 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
10 . $(dirname $0)/lib/probe.sh
12 skip_if_no_perf_probe || exit 2
14 . $(dirname $0)/lib/probe_vfs_getname.sh
16 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
17 file=$(mktemp /tmp/temporary_file.XXXXX)
20 echo "Recording open file:"
21 perf record -o ${perfdata} -e probe:vfs_getname touch $file
24 perf_script_filenames() {
25 echo "Looking at perf.data file for vfs_getname records for the file we touched:"
26 perf script -i ${perfdata} | \
27 egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname: +\([[:xdigit:]]+\) +pathname=\"${file}\""
30 add_probe_vfs_getname || skip_if_no_debuginfo
32 if [ $err -ne 0 ] ; then
36 record_open_file && perf_script_filenames
40 cleanup_probe_vfs_getname