(1)从http://prdownloads.sourceforge.net/下载最新版的oprofile.现在最新的版本是0.9.3.
(2)解开下载的安装包,编译并安装
tar -xvzf oprofile-0.9.3.tar.gz
cd oprofile-0.9.3
./configure --with-kernel-support
make
make install
这样oprofile就被安装在/usr/local/bin下。可以通过在configure指定--exec-prefix来改变安装的目录。 安装完成后,在/usr/local/bin可以发现如下的工具集
name: event name, e.g. CYCLES or ICACHE_MISSES
count: reset counter value e.g. 100000
unitmask: hardware unit mask e.g. 0x0f
kernel: whether to profile kernel: 0 or 1
user: whether to profile userspace: 0 or 1
CPU: PIII, speed 800 MHz (estimated)
Counted CPU_CLK_UNHALTED events (clocks processor is not halted) with a unit mask of 0x00 (No unit mask) count 100000
samples % linenr info symbol name
205214 100.000 count.c:3 main