gpt4 book ai didi

C gperftools - 分析 C 代码

转载 作者:行者123 更新时间:2023-11-30 17:23:21 31 4
gpt4 key购买 nike

我正在尝试为我使用 gperftools 的代码生成分析(逐行源代码)。

gcc a.c -lprofiler -Wl,--no-as-needed -lprofiler -Wl,--as-needed

CPUPROFILE=out.ptof ./a.out

但是

pprof  ./a.out out.ptof --inuse_objects --lines --heapcheck  --edgefraction=1e-10 --nodefraction=1e-10 --gv
Using local file ./a.out.
Using local file out.ptof.
No nodes to print

为什么 pprof 声明“没有要打印的节点”?

最佳答案

看来there might be several reasons

引用最有可能的(假设您的代码很简单):

If you see a message like "No nodes to print" [...] it simply means that the code was so fast that it couldn't be profiled - basically, the profiler never even had a chance to take a sample.

还有:

In the default mode, there will be no profiling data for the 'slow' route, because it uses few CPU cycles (You'll see the message 'No nodes to print').

所以你可能需要人为地减慢你的程序......

关于C gperftools - 分析 C 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27633498/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com