全部博文(51)
分类: LINUX
2020-12-17 14:09:08
root@jianlin-100:/home/jianlin# perf probe -L do_sys_open 0 long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode) { 2 struct open_how how = build_open_how(flags, mode); 3 return do_sys_openat2(dfd, filename, &how); } |
root@jianlin-100:/home/jianlin# perf probe -V do_sys_open Available variables at do_sys_open @ char* filename int dfd int flags struct open_how how umode_t mode |
root@jianlin-100:/home/jianlin# perf probe -a 'do_sys_open filename:string' Added new event: probe:do_sys_open (on do_sys_open with filename:string) You can now use it in all perf tools, such as: perf record -e probe:do_sys_open -aR sleep 1 |
root@jianlin-100:/home/jianlin# perf record -e probe:do_sys_open -aR cat ./kube-join.info > /dev/null cat: ./kube-join.info: No such file or directory [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.180 MB perf.data (18 samples) ] |
root@jianlin-100:/home/jianlin# perf report --stdio # To display the perf.data header info, please use --header/--header-only options. # # # Total Lost Samples: 0 # # Samples: 18 of event 'probe:do_sys_open' # Event count (approx.): 18 # # Overhead Command Shared Object Symbol # ........ ....... ................ ............... # 94.44% cat [kernel.vmlinux] [k] do_sys_open 5.56% perf [kernel.vmlinux] [k] do_sys_open |
root@jianlin-100:/home/jianlin# perf script perf 3559160 [007] 1710448.751491: probe:do_sys_open: (ffff800010368e20) filename_string="/proc/3559161/status" cat 3559161 [001] 1710448.752954: probe:do_sys_open: (ffff800010368e20) filename_string="/etc/ld.so.cache" cat 3559161 [001] 1710448.752993: probe:do_sys_open: (ffff800010368e20) filename_string="/lib/aarch64-linux-gnu/libc.so.6" cat 3559161 [001] 1710448.753307: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/lib/locale/locale-archive" cat 3559161 [001] 1710448.753397: probe:do_sys_open: (ffff800010368e20) filename_string="./kube-join.info" cat 3559161 [001] 1710448.753530: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/locale.alias" cat 3559161 [001] 1710448.753628: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753637: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753645: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en_US/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753652: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753659: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753665: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale/en/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753674: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753683: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753690: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753698: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753706: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo" cat 3559161 [001] 1710448.753715: probe:do_sys_open: (ffff800010368e20) filename_string="/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo" |
root@jianlin-100:/home/jianlin# perf report --sort filename_string # To display the perf.data header info, please use --header/--header-only options. # # # Total Lost Samples: 0 # # Samples: 18 of event 'probe:do_sys_open' # Event count (approx.): 18 # # Overhead filename_string # ........ ............................................................ # 5.56% "/usr/share/locale/locale.alias" 5.56% "/usr/share/locale/en_US/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale/en/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo" 5.56% "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo" 5.56% "/usr/lib/locale/locale-archive" 5.56% "/proc/3559161/status" 5.56% "/lib/aarch64-linux-gnu/libc.so.6" 5.56% "/etc/ld.so.cache" 5.56% "./kube-join.info" |
root@jianlin-100:/home/jianlin# perf probe -F |grep -i vxlan root@jianlin-100:/home/jianlin# |
root@jianlin-100:/home/jianlin# perf probe -m /lib/modules/5.10.0-rc3+/kernel/drivers/net/vxlan.ko -L vxlan_xmit 0 static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) { 2 struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_rdst *rdst, *fdst = NULL; const struct ip_tunnel_info *info; bool did_rsc = false; struct vxlan_fdb *f; struct ethhdr *eth; __be32 vni = 0; info = skb_tunnel_info(skb); 12 skb_reset_mac_header(skb); 14 if (vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) { 15 if (info && info->mode & IP_TUNNEL_INFO_BRIDGE && |
root@jianlin-100:/home/jianlin# perf probe -m /lib/modules/5.10.0-rc3+/kernel/drivers/net/vxlan.ko -a 'vxlan_xmit dev->name:string' Added new event: probe:vxlan_xmit (on vxlan_xmit in vxlan with name=dev->name:string) You can now use it in all perf tools, such as: perf record -e probe:vxlan_xmit -aR sleep 1 root@jianlin-100:/home/jianlin# perf record -e probe:vxlan_xmit -a ping -c 3 172.200.18.102 PING 172.200.18.102 (172.200.18.102) 56(84) bytes of data. 64 bytes from 172.200.18.102: icmp_seq=1 ttl=64 time=0.770 ms 64 bytes from 172.200.18.102: icmp_seq=2 ttl=64 time=0.878 ms 64 bytes from 172.200.18.102: icmp_seq=3 ttl=64 time=0.799 ms --- 172.200.18.102 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 0.770/0.815/0.878/0.045 ms [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.194 MB perf.data (3 samples) ] root@jianlin-100:/home/jianlin# perf report -n --sort name # To display the perf.data header info, please use --header/--header-only options. # # # Total Lost Samples: 0 # # Samples: 3 of event 'probe:vxlan_xmit' # Event count (approx.): 3 # # Overhead Samples name # ........ ............ .......... # 100.00% 3 "vxlan100" # Samples: 0 of event 'dummy:HG' # Event count (approx.): 0 # # Overhead Samples # ........ ............ # # # (Tip: For a higher level overview, try: perf report --sort comm,dso) # |