如何使用 ftrace 获取系统调用调用的内核调用图?
我已经尝试过这些,但它们都产生“空”输出文件:
trace-cmd record -p function_graph -g munmap -F ls
trace-cmd record -p function_graph -g sys_enter_munmap -F ls
trace-cmd record -p function_graph -g sys_enter -F ls
I've tried these, but all of them produce "empty" output files:
trace-cmd record -p function_graph -g munmap -F ls
trace-cmd record -p function_graph -g sys_enter_munmap -F ls
trace-cmd record -p function_graph -g sys_enter -F ls
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要获得正确的函数名称 - 例如,用于跟踪
open
系统调用的函数名称是sys_open
。要以“正确”的方式执行此操作,内核中必须有
function_graph
支持。在 x86 架构上这取决于禁用 CC_OPTIMIZE_FOR_SIZE,但在 x86_64 上则不然t。就我而言,我没有费心编译自定义内核来禁用 CC_OPTIMIZE_FOR_SIZE,我只是做了
并包含了各种看起来可能通过添加几个
-l
选项来调用的函数。这足以弄清楚我想知道什么。First you need to get the function name right - e.g. the function name to use for tracing
open
syscalls issys_open
.To do this the "proper" way, it's necessary to have
function_graph
support in the kernel. On the x86 architecture this depends on CC_OPTIMIZE_FOR_SIZE being disabled, but on x86_64 it doesn't.In my case I didn't bother to compile a custom kernel to disable CC_OPTIMIZE_FOR_SIZE, I just did
and included various functions that looked like they might be called by adding several
-l
options. This was enough to figure out what I wanted to know.