oprofile
某処理のボトルネックを探るため、
oprofileというのを始めて使ってみた。
Fedoraだと、
#yum -y install oprofile
で入る。
カーネル内の関数のプロファイルを取りたいときは、
# yum -y install kernel-debug
rebootして、fc8debugというカーネルを選択してブート。
#↑kernel-debugのインストールは、もしかしたら要らないかもしれない。。。
/etc/yum.d/内のファイルのうち、
debuginfo関係のやつをenabled=1にする。
で、
#yum install -y kernel-debug-debuginfo
これで、vmlinuxファイルが入る。
さて、oprofileを使う。
と思ったら、VMWareのゲストマシン上のLinuxでは↓が必要
opcontrol --deinit; modprobe oprofile timer=1; opcontrol --start
http://www.nabble.com/Oprofile---VMware:-workaround-doesn't-work-td14741159.html
以下は、全てのばあいに必要。
カーネル内のシンボル名を知るため
# opcontrol --vmlinux=/usr/lib/debug/lib/modules/2.6.23.15-137.fc8debug/vmlinux
開始。
# opcontrol --start<プロファイルを取りたい操作>
# opcontrol --dump
# opcontrol --stop
結果は
#opreport -l
で見る。
結果をリセットする時は
#opcontrol --reset