如何在 systemtap 中使用调试信息进行 user-space 探测
How to do user-space probing using debug info in systemtap
我是 systemtap 的新手,想了解如何使用应用程序中的调试信息将检测动态附加到生产应用程序。
对于目标应用程序(例如 apache 网络服务器)。我想找出执行给定函数所花费的时间。即我想使用函数的符号信息找到函数从开始到结束所花费的时间。我如何使用 systemtap 执行此操作 - 你能给出以下说明吗:
- 用于用户的 tapset 脚本-space 使用调试信息进行探测
- 如何使用目标应用程序执行此 tapset 脚本。
特别是我想了解如何使用基于调试信息的工具进行用户 space 跟踪。
这里是 "Debuginfo-based information" 的参考 - https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
列举函数:
stap -L 'process("/usr/sbin/httpd").function("*").call'
函数调用率的基本统计:
stap /usr/share/doc/systemtap*/examples/*/eventcount.stp \
'process("/usr/sbin/httpd").function("*").call'
函数计时:
stap -e 'probe process("/usr/sbin/httpd").function("ap_getword_conf").return {
printf("%s %d\n", ppfunc(), gettimeofday_us()-@entry(gettimeofday_us()))
}'
我是 systemtap 的新手,想了解如何使用应用程序中的调试信息将检测动态附加到生产应用程序。
对于目标应用程序(例如 apache 网络服务器)。我想找出执行给定函数所花费的时间。即我想使用函数的符号信息找到函数从开始到结束所花费的时间。我如何使用 systemtap 执行此操作 - 你能给出以下说明吗:
- 用于用户的 tapset 脚本-space 使用调试信息进行探测
- 如何使用目标应用程序执行此 tapset 脚本。
特别是我想了解如何使用基于调试信息的工具进行用户 space 跟踪。
这里是 "Debuginfo-based information" 的参考 - https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
列举函数:
stap -L 'process("/usr/sbin/httpd").function("*").call'
函数调用率的基本统计:
stap /usr/share/doc/systemtap*/examples/*/eventcount.stp \
'process("/usr/sbin/httpd").function("*").call'
函数计时:
stap -e 'probe process("/usr/sbin/httpd").function("ap_getword_conf").return {
printf("%s %d\n", ppfunc(), gettimeofday_us()-@entry(gettimeofday_us()))
}'