kernel CONFIG_FRACE

 

编写应用程序时,如果查看函数的实际执行效率,就可以选择开启内核的CONFIG_FTRACE选项。

上层通过perf-tools配合,就可以查看指定程序的调用情况。

root@vmuser:~/tmp/perf-tools# ./bin/uprobe -s p:/root/a.out:signalHandler


a.out-21789 [000] d... 82183.441301: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.441302: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.442297: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.442298: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.443293: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.443294: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.444301: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.444302: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.445298: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.445299: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.446296: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.446296: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.447294: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.447294: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.448294: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.448295: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.449294: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.449295: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.450293: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.450293: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.451294: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.451295: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.452296: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.452296: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.453295: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.453295: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb97>
a.out-21789 [000] d... 82183.454293: signalHandler: (0x5629c1e966da)
a.out-21789 [000] d... 82183.454293: <user stack trace>
=> <00005629c1e966da>
=> <00007f54b1fecb^C
Ending tracing...

上一篇:巨亏43亿,暴跌90% 退市危机


下一篇:程序流程结构——if语句