如何解释 Systemtap futexes.stp 的输出
How to interpret the output from Systemtap's futexes.stp
我试图在我的代码中找到锁争用,我在标准 systemtap 版本中找到了 futexes.stp。但是我对输出有几个问题:
stap -d /usr/local/bin/cruncher ~/futexes.stp
(and then I run cruncher application in another term)
auditd[1803] lock 0x564dd507f228 contended 2 times, 119 avg us
auditd[1803] lock 0x564dd507f254 contended 28 times, 458040 avg us
rs:main Q:Reg[1837] lock 0x5563b67c2044 contended 7 times, 2352067 avg us
...
cruncher[17021] lock 0x7f6c9c57914c contended 2 times, 46 avg us
cruncher[17021] lock 0x7eff50 contended 82 times, 16 avg us
cruncher[17021] lock 0x7f6c40901f24 contended 20 times, 109 avg us
cruncher[17021] lock 0x7f6f38e0633c contended 4471 times, 2106 avg us
cruncher[17021] lock 0x7dae7c0 contended 8861 times, 26 avg us
cruncher[17021] lock 0x7f6cc2f14560 contended 2 times, 9 avg us
cruncher[17021] lock 0x7f6c8685d024 contended 5 times, 95 avg us
cruncher[17021] lock 0x7f6cd9e2ded4 contended 6 times, 428 avg us
cruncher[17021] lock 0x7f6c5196937c contended 44 times, 484 avg us
cruncher[17021] lock 0x7f6ba20c0290 contended 4 times, 8 avg us
...
下面是问题:
所有那些带有 0x7f 的结构............堆栈地址?我确定它不是来自我的应用程序。那些库或内核互斥量(或条件变量)代表我的应用程序吗?我该如何验证?
短地址的 "locks" 是我的。我可以使用 gdb 的 "info symbol " 命令验证它们,但是从 stap 自动将其解码为符号的好方法是什么?
我正在使用在同一个盒子上构建的 Linux 4.6.2 主线内核,以及来自他们 git 存储库的最新 systemtap。我的 cruncher 应用程序是用 -g 构建的,符号没有被删除。
提前致谢!
lock 0x7f...
地址是传递给 futex(2)
系统调用的用户空间指针。该脚本只是逐字存储它们。它们很可能指向 glibc pthreads-mutex 类型对象的内部。
至于哪个对象...必须添加地址到符号查找阶段。它可能通过使用另一个探测器拦截 pthread 互斥初始化来工作,以 assemble a table pthread 锁。或者通过向传入的 futex 地址添加 usymdata(...)
查找。请参阅 mutex-contention.stp
示例脚本以了解如何使用这两种技术。
我试图在我的代码中找到锁争用,我在标准 systemtap 版本中找到了 futexes.stp。但是我对输出有几个问题:
stap -d /usr/local/bin/cruncher ~/futexes.stp
(and then I run cruncher application in another term)
auditd[1803] lock 0x564dd507f228 contended 2 times, 119 avg us
auditd[1803] lock 0x564dd507f254 contended 28 times, 458040 avg us
rs:main Q:Reg[1837] lock 0x5563b67c2044 contended 7 times, 2352067 avg us
...
cruncher[17021] lock 0x7f6c9c57914c contended 2 times, 46 avg us
cruncher[17021] lock 0x7eff50 contended 82 times, 16 avg us
cruncher[17021] lock 0x7f6c40901f24 contended 20 times, 109 avg us
cruncher[17021] lock 0x7f6f38e0633c contended 4471 times, 2106 avg us
cruncher[17021] lock 0x7dae7c0 contended 8861 times, 26 avg us
cruncher[17021] lock 0x7f6cc2f14560 contended 2 times, 9 avg us
cruncher[17021] lock 0x7f6c8685d024 contended 5 times, 95 avg us
cruncher[17021] lock 0x7f6cd9e2ded4 contended 6 times, 428 avg us
cruncher[17021] lock 0x7f6c5196937c contended 44 times, 484 avg us
cruncher[17021] lock 0x7f6ba20c0290 contended 4 times, 8 avg us
...
下面是问题:
所有那些带有 0x7f 的结构............堆栈地址?我确定它不是来自我的应用程序。那些库或内核互斥量(或条件变量)代表我的应用程序吗?我该如何验证?
短地址的 "locks" 是我的。我可以使用 gdb 的 "info symbol " 命令验证它们,但是从 stap 自动将其解码为符号的好方法是什么?
我正在使用在同一个盒子上构建的 Linux 4.6.2 主线内核,以及来自他们 git 存储库的最新 systemtap。我的 cruncher 应用程序是用 -g 构建的,符号没有被删除。
提前致谢!
lock 0x7f...
地址是传递给 futex(2)
系统调用的用户空间指针。该脚本只是逐字存储它们。它们很可能指向 glibc pthreads-mutex 类型对象的内部。
至于哪个对象...必须添加地址到符号查找阶段。它可能通过使用另一个探测器拦截 pthread 互斥初始化来工作,以 assemble a table pthread 锁。或者通过向传入的 futex 地址添加 usymdata(...)
查找。请参阅 mutex-contention.stp
示例脚本以了解如何使用这两种技术。