gprof一个库-问题 [英] gprof a library - question
问题描述
我需要在我们的系统中gprof一个库来检查函数调用,并查看是否可以对其进行优化.基本上,我拥有的是
I need to gprof a library in our system to examine the function calls and see if we can optimize it any more. Basically, what I have is
使用共享库myLib.so的可执行文件A
Executable A which uses a shared Library myLib.so
我要gprof myLib.so.当我使用-pg选项编译myLib.so源代码时,它会生成一个.so文件.
I want to gprof the myLib.so. When I compile myLib.so source using -pg option, it produces a .so file just fine.
但是,由于某种原因,针对该库重新编译可执行文件A并不会生成* .gmon文件.需要做什么?我应该静态链接myLib吗?如果是这样,请告诉我如何.我是新手,所以请原谅我的无知.我每天都在学习
But, recompiling the Executable A against that library is not producing the *.gmon file for some reason. What needs to be done? Should I link the myLib statically? If so, please tell me how. I am a newbie, so pardon my ignorance. I am learning everyday
提前谢谢.
推荐答案
您可以使用良好的采样分析器,例如 RotateRight/Zoom ,也可以尝试
You could use a good sampling profiler like RotateRight/Zoom, or you could try this technique. Also lsstack serves well. pstack does too, but is more work for you.
这篇关于gprof一个库-问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!