gprof 看performance分析…

posted in: computer, 有的沒的 | 0

用 gcc 加參數看程式的performance分析…

compiler 時加參數 -pg
gcc -pg test.c
./a.out

然後, 打
gprof a.out > test
去看 test 檔, 可以看到很多有用的 performance analysis 的資訊

一個 funtion 執行幾次, 被那些呼叫, 佔執行時間多少…等等…