• Michael Petlan's avatar
    perf test: Allow multiple probes in record+script_probe_vfs_getname.sh · 194cb6b5
    Michael Petlan authored
    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: default avatarMichael Petlan <mpetlan@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    LPU-Reference: 20200722135845.29958-1-mpetlan@redhat.com
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    194cb6b5
record+script_probe_vfs_getname.sh 1.21 KB