linux内核计数函数,有办法统计内核中某个函数的耗时吗?

this if from INTEL engineer:

http://software.intel.com/en-us/forums/intel-vtune-performance-analyzer/topic/44506/

-------------------------

First, you can get callgraph data on kernel modules depending on when they come in to use, but, you can NEVER get callgraph data on the kernel itself.

You may or may not know that callgraph works by performing a binary instrumentation on the code you want to profile.

That means when you launch a VTune callgraph session, VTune inserts its profiling codes into the method prologs of your app. Then, VTune runs that instrumented binary to obtain the graph of the flow of control  for that app.

To illustrate this, imagine that you run a simple sampling session, such as:

$ vtl activity -c callgraph -app "/bin/ls" -moi "/bin/ls" run

and then snooped around in the VTune working directories during this experiment (which probably won't run too long), you'd find a new binary called ../bin__ls which is the binary that callgraph created, instrumented, and ran to figure out the /bin/ls flow of control and report it back to you.

If your kernel driver can be loaded up after boot, call graph should have no problems examining it. If however your kernel driver MUST come into play before you're in multiuser mode on the server, then callgraph won't be able to work for you.

You should still be able to sample, however: anything that runs on the processor can be seen via a VTune sampling session, since sampling doesn't require any instrumentation to locate CPU events.

Earlier I mentioned you can't run callgraph on the kernel, and if you stop and think about it that's because you can't boot a standard Linux kernel, instrument a second one, and then BOOT that second one at the same time.

On a closing note, there are some VTune pause and resume APIs that come with the VTune product, that you can invoke in your own code to obtain sampling and callgraph data. BUT, VTune has to be running for this to work, so, until you're in multiuser mode, that won't be of much help either.

【 在 tdhlshx (沧海月~Tobe crazy isbetterthan foolish) 的大作中提到: 】

: 我记得intel的人告诉过我至少vtune不支持内核的call graph...:(

: Intel谁说的?拖出去打100大板! :D

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值