C++ 为什么我在调用图中看到的边不';使用gperf工具不存在吗?

C++ 为什么我在调用图中看到的边不';使用gperf工具不存在吗?,c++,call-graph,gperftools,C++,Call Graph,Gperftools,给定以下调用f或g的代码 #include <stdlib.h> #include <stdio.h> int f() { return 0; } int g() { return 1; } int main() { long sum = 0; for(int i = 0; i < 1000*1000*1000; i++) { int result; if(rand() % 2 == 0) {

给定以下调用f或g的代码

#include <stdlib.h>
#include <stdio.h>

int f() {
    return 0;
}

int g() {
    return 1;
}

int main() {
    long sum = 0;
    for(int i = 0; i < 1000*1000*1000; i++) {
        int result;
        if(rand() % 2 == 0) {
            result = f();
        }
        else {
            result = g();
        }

        sum += result;
    }
    printf("%ld\n", sum);
}

CPUPROFILE=./test.txt ./test
然后生成一个带有

pprof --gif ./test ./test.txt > output.gif
我得到以下信息

然而,我有从f到g的边,f到它自己,g到它自己。在上没有任何优化(我用-O0再次尝试了),我也用和不用-lunwind进行了尝试


为什么探查器认为f调用g(有时也调用g本身)?如何正确使用探查器?

(此处无答案)fg边缘不再显示在当前版本中(使用git HEAD)是的,最新发布的版本不再存在此问题。
pprof --gif ./test ./test.txt > output.gif