Would the time counted in gprof include what is spent in functions that are not profiled?

痴心易碎 提交于 2019-12-04 20:43:38
Mike Dunlavey

No, because the way gprof works, it samples the program counter, figures out which function the program counter is in, and increments the self time for that function.

In addition, it counts the number of times any function A calls any function B.

From that, it tries to figure everything else out.

Of course, this only works for functions it knows about.

It's very clever, but you can do better.

ADDED: since somebody in their wisdom decided to delete the above post, here is a brief summary of how you can do better:

Try this instead.
Here's an example of a 44x speedup.
Here's a 730x speedup.
Here's an explanation of the statistics.
Here's an answer to critiques.
Here's an 8-minute video demonstration.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!