我分析了一些在 Linux 上运行的非常简单的 C++ 程序。所有这些的 main() 的包含成本远不是 100%,大约是 3.83%。我正确使用 callgrind 吗?我在下面粘贴了callgrind_annotate
with的输出。--inclusive=yes
该程序称为堆,它进行简单的堆排序。我使用的命令是
valgrind --tool=callgrind ./heap
然后,我输入
callgrind_annotate --inclusive=yes callgrind.out.25434
输出:
`--------------------------------------------------------------------------------
Profile data file 'callgrind.out.25434' (creator: callgrind-3.6.0)
`--------------------------------------------------------------------------------
I1 cache:
D1 cache:
LL cache:
Timerange: Basic block 0 - 361578
Trigger: Program termination
Profiled target: ./heap (PID 25434, part 1)
Events recorded: Ir
Events shown: Ir
Event sort order: Ir
Thresholds: 99
Include dirs:
User annotated:
Auto-annotation: off
`--------------------------------------------------------------------------------
Ir
`--------------------------------------------------------------------------------
2,552,558 PROGRAM TOTALS
`--------------------------------------------------------------------------------
Ir file:function
`--------------------------------------------------------------------------------
2,552,558 ???:0x00000810 [/lib/ld-2.7.so]
2,515,793 ???:0x00000a60 [/lib/ld-2.7.so]
2,515,219 ???:0x00015270 [/lib/ld-2.7.so]
2,514,780 ???:0x000021e0 [/lib/ld-2.7.so]
2,456,164 ???:0x0000b2f0 [/lib/ld-2.7.so]
2,256,719 ???:0x00009e40 [/lib/ld-2.7.so]
1,702,371 ???:0x00009ac0 [/lib/ld-2.7.so]
657,883 ???:0x000098e0 [/lib/ld-2.7.so]
367,045 ???:0x00017040 [/lib/ld-2.7.so]
33,170 ???:0x080483e0 [/home/test/heap]
33,036 ???:0x0000ce60 [/lib/ld-2.7.so]
31,347 ???:0x0000e850 [/lib/ld-2.7.so]
30,706 ???:(below main) [/lib/libc-2.7.so]
30,071 ???:0x00008570 [/lib/ld-2.7.so]
27,954 ???:0x0000f500 [/lib/ld-2.7.so]
27,758 ???:0x0000ca30 [/lib/ld-2.7.so]
21,366 ???:0x0001767b [/lib/ld-2.7.so]