9
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Callgrind + Kcachegrindで関数呼び出しのトレースをする

9
Posted at

まずはインストール

sudo apt-get install valgrind kcachegrind

次にトレースデータを収集する.
トレースする対象は任意のバイナリでOK.
デバッグシンボルがついていれば詳細な情報が集められるけど, 無くてもよい.

valgrind --tool=callgrind hoge.out

トレースが完了すると, callgrind.out.xxxx(xxxxは割り振られた適当な番号)というトレースデータのファイルができるのでそれをkcachegrindに食わせる.

kcachegrind callgrind.out.xxxx

すると関数呼び出しの統計データやコールグラフなどがビジュアルに表示される。

これは良いですね。

ちなみに、valgrind(とkcachegrind)を使うことでキャッシュミスやメモリリークの解析などもできるできるらしい.
http://kzk9.net/column/valgrind.html

9
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?