我有這樣我的應用程序運行callgrind:需要幫助的閱讀callgrind輸出
valgrind --tool=callgrind MyApplication
,然後調用:
callgrind_annotate --auto=yes ./callgrind.out.2489
我看到輸出如下:
768,097,560 PROGRAM TOTALS
--------------------------------------------------------------------------------
Ir file:function
--------------------------------------------------------------------------------
18,624,794 /build/buildd/eglibc-2.11.1/elf/dl-lookup.c:do_lookup_x
[/lib/ld-2.11.1.so]
18,149,492 /src/js/src/jsgc.cpp:JS_CallTracer'2
[/src/firefox-debug-objdir/js/src/libmozjs.so]
16,328,897 /src/layout/style/nsCSSDataBlock.cpp:nsCSSExpandedDataBlock::DoAssertInitialState()
[/src/firefox-debug-objdir/toolkit/library/libxul.so]
13,376,634 /build/buildd/eglibc-2.11.1/nptl/pthread_getspecific.c:pthread_getspecific
[/lib/libpthread-2.11.1.so]
13,005,623 /build/buildd/eglibc-2.11.1/malloc/malloc.c:_int_malloc
[/lib/libc-2.11.1.so]
10,404,453 ???:0x0000000000009190 [/usr/lib/libpangocairo-1.0.so.0.2800.0]
10,358,646 /src/xpcom/io/nsFastLoadFile.cpp:NS_AccumulateFastLoadChecksum(unsigned
int*, unsigned char const*, unsigned int, int)
[/src/firefox-debug-objdir/toolkit/library/libxul.so]
8,543,634 /src/js/src/jsscan.cpp:js_GetToken
[/src/firefox-debug-objdir/js/src/libmozjs.so]
7,451,273 /src/xpcom/typelib/xpt/src/xpt_arena.c:XPT_ArenaMalloc
[/src/firefox-debug-objdir/toolkit/library/libxul.so]
7,335,131 ???:g_type_check_instance_is_a [/usr/lib/libgobject-2.0.so.0.2400.0]
我有幾個問題:
右邊的數字是什麼意思?這是否意味着它花費累積很長時間才能調用右邊的函數?我怎樣才能知道該函數被調用了多少次?它是否包含調用該函數調用函數的時間?
與
???
是什麼意思?例如???:0x0000000000009190 [/usr/lib/libpangocairo-1.0.so.0.2800.0]
如果您使用的是Mac: http://stackoverflow.com/questions/4473185/do-you-have-kcachegrind-like-profiling-tools-for-mac – brokenfoot 2016-05-19 20:36:58