内核支持:
.config 文件选项
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
重新编译,替换内核,重启系统
下载源代码:
wget http://prdownloads.sourceforge.net/oprofile/oprofile-1.1.0.tar.gz
解压:
tar -zxcf oprofile-1.1.0.tar.gz
编译:
预备工作:
sudo apt-get install binutils-dev libiberty-dev libpopt-dev -y
1. ./configure
但是出现下面警告,
Warning: The user account 'oprofile:oprofile' does not exist on the system.
To profile JITed code, this special user account must exist.
Please ask your system administrator to add the following user and group:
user name : 'oprofile'
group name: 'oprofile'
The 'oprofile' group must be the default group for the 'oprofile' user.
这个错误不能忽略,如果这个不解决,后面执行也会出错.
意思是需要添加指定用户,原因不想翻译,
sudo groupadd oprofile
sudo useradd -g oprofile oprofile
2. make
3. sudo make install
4. 测试程序
sudo operf ./sandiego_osg_es2
sandiego_osg_es2 是我自己测试的程序,用自己的需要测试的替换.
Your kernel's Performance Events Subsystem does not support your processor type.
fuck...
Note
Some older processor models are not supported by the underlying perf_events kernel and, thus, are not supported by operf . If you receive the message Your kernel's Performance Events Subsystem does not support your processor type |
原来是我的CPU太信了,不支持,~~~~呜呜~~~~