perf probe
https://hustcat.github.io/perf-trace-and-perf-probe/
Bash下:
perf probe -x /lib64/libc.so.6 '--add=__GI_read fd=%di buf=%si len=%dx'
perf record -e probe_libc:__GI_read -aRg -p 917 --filter 'fd==0x3a' ===========fd值来自下面
bash-4.4# perf script
注意点 read可能不能被 record 。。。。。
bash-4.4# perf probe -x /lib64/libc.so.6 '--add=read fd=%di buf=%si len=%dx'
Added new event:
probe_libc:read (on read in /lib64/libc-2.28.so with fd=%di buf=%si len=%dx)
You can now use it in all perf tools, such as:
perf record -e probe_libc:read -aR sleep 1
bash-4.4# perf record -e probe_libc:read -aR sleep 1
event syntax error: 'probe_libc:read'
\___ parser error
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
bash-4.4# perf probe -l
probe_libc:read (on __GI_read in /lib64/libc-2.28.so with fd buf len)
bash-4.4# perf probe -x /lib64/libc.so.6 '--add=__GI_read fd=%di buf=%si len=%dx'
Added new event:
probe_libc:__GI_read (on __GI_read in /lib64/libc-2.28.so with fd=%di buf=%si len=%dx)
You can now use it in all perf tools, such as:
perf record -e probe_libc:__GI_read -aR sleep 1
bash-4.4# perf record -e probe_libc:__GI_read -aR sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.024 MB perf.data (330 samples) ]
bash-4.4# perf script
sleep 3686 [000] 5408.696390: probe_libc:__GI_read: (7fda2231d6d0) fd=0x7 buf=0x56506bafc9a0 len=0x400
sleep 3686 [000] 5408.696429: probe_libc:__GI_read: (7fda2231d6d0) fd=0x7 buf=0x56506bafc9a0 len=0x400
swapper 0 [000] 5408.724221: probe_libc:__GI_read: (7f5a9bef36d0) fd=0x1e buf=0x55daf0dbd090 len=0x400
swapper 0 [000] 5408.724297: probe_libc:__GI_read: (7f5a9bef36d0) fd=0x1e buf=0x55daf0dbd090 len=0x400
swapper 0 [000] 5408.724355: probe_libc:__GI_read: (7f5a9bef36d0) fd=0x1e buf=0x55daf0dbd090 len=0x400
bash-4.4# perf record -e probe_libc:__GI_read -aRg --filter 'len==0x400' sleep 2
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.999 MB perf.data (156 samples) ]
bash-4.4# perf script
sleep 3746 [000] 5505.194003: probe_libc:__GI_read: (7f8f97a636d0) fd=0x7 buf=0x562658cc09a0 len=0x400
7f8f97a636d0 read+0x0 (/usr/lib64/libc-2.28.so)
sleep 3746 [000] 5505.194048: probe_libc:__GI_read: (7f8f97a636d0) fd=0x7 buf=0x562658cc09a0 len=0x400
7f8f97a636d0 read+0x0 (/usr/lib64/libc-2.28.so)
diagd 928 [000] 5505.229120: probe_libc:__GI_read: (7f4fe489c6d0) fd=0x45 buf=0x2288c90 len=0x400
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-03-18 slub分配器---2022