一、关于动态追踪
动态追踪,就是在系统或者应用程序正常运行的时候,通过内核中提供的探针,来动态追踪它们的行为,从而辅助排查出性能问题的瓶颈。
使用动态追踪,可以在不修改代码、不重启服务的情况下,动态了解应用程序或者内核的行为,这对排查线上问题、特别是不容易重现的问题尤其有效。
在 Linux 系统中,常见的动态追踪方法包括 ftrace、perf、eBPF 以及 SystemTap 等。
二、、trace-cmd的安装
# yum -y install trace-cmd
# yum info trace-cmd
三、trace-cmd的使用
# trace-cmd record -p function_graph -g do_sys_open -O funcgraph-proc ls
# trace-cmd report
四、参考
动态追踪技术漫谈
https://blog.openresty.com.cn/cn/dynamic-tracing
ftrace和trace-cmd:跟踪内核函数的利器
https://simpleiot.blog.csdn.net/article/details/103587609
OpenResty,通过 Lua 扩展 NGINX 实现的可伸缩的 Web 平台
http://openresty.org/cn
OpenResty XRay,实时透视系统诊断与优化您企业的关键软件应用
https://openresty.com.cn/cn/xray
章亦春的Nginx 教程
http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html#00-Foreword01
Exploring USDT Probes on Linux
https://leezhenghui.github.io/linux/2019/03/05/exploring-usdt-on-linux.html