torutkのブログ

ソフトウェア・エンジニアのブログ

VMware上のLinux(CentOS)でoprofileの使用

プロファイラoprofileで性能計測ができると聞いて、自宅PCで実験してみましたが、機能していません。

# opcontrol --start
Using default event: CPU_CLK_UNHALTED:100000:0:1:1
Using 2.6+ OProfile kernel interface.
Using log file /var/lib/oprofile/samples/oprofiled.log
Daemon started.
# opcontrol --stop
Stopping profiling.
# opreport
opreport error: No sample file found: try running opcontrol --dump
or specify a session containing sample files

Windows OSをホストOSとしたVMware上のゲストOSでCentOSを動かしているので、これかと思い調べてみると、OprofileのFAQで思いっきり

OProfile can't work with VMware when using performance counter interface. A workaround is to use RTC mode (2.4 kernel) or timer interrupt mode (2.6 kernel)

とありました。でも、回避方法があるらしいので一途の望みをもってさらに調べてみると、以下のブログで回避方法が紹介されていました。

$ opcontrol --deinit

Now load it manually but passing an argument:

$ modprobe oprofile timer=1