应用程序源码编译(本地编译)
1.git-clone git://git.printk.org/caiwanwei/oprofile-0.9.7
2.tar xf oprofile-0.9.7; cdoprofile-0.9.7
3. ./configure --with-kernel-support
4. make
5. sudo make install
内核模块编译(交叉编译,也可选择本地编译)
1.git-clonegit://git.printk.org/linux-loongson-release.git
2.make ARCH=mips menuconfig
3.General Setup->Profilingsupport->OProfile systemprofiling选为<M>
4.make ARCH=mipsCROSS_COMPILE=/path/to/toolchain/gcc4.6/install/bin/mips64el-linux-
(交叉编译)
5.scp vmlinux.32root@IP.OF.LOONGSON3.MACHINE:/boot/vmlinux
6.make modules_install ARCH=mipsCROSS_COMPILE=/path/to/toolchain/gcc4.6/install/bin/mips64el-linux-
INSTALL_MOD_PATH=./modules_install/
7.cd modules_install
8.
tar zcf - lib | ssh root@192.168.1.177 tarzxf - -C /
(将oprofile模块拷贝到Loongson3机器上)
使用
sudo opcontrol --init
sudo opcontrol --reset
sudo opcontrol --vmlinux=/boot/vmlinux
sudo opcontrol --setup --separate=kernel--event=CPU_CLK_UNHALTED:50000:0:1:1
sudo opcontrol --start
./test.out
sudo opcontrol --shutdown
opreport -l ./test.out