测试perfctr-2.6.x下面的例子,出现结果,证明安装perfctr安装成功
[root@gc04vm13 perfctr-2.6.x]# examples/global/global
PerfCtr Info:
abi_version 0x05010501
driver_version 2.6.32 DEBUG
cpu_type 5 (?)
cpu_features 0x7 (rdpmc,rdtsc,pcint)
cpu_khz 2259879
tsc_to_cpu_mult 1
cpu_nrctrs 0
cpus [0], total: 1
cpus_forbidden [], total: 0
cpu type 5 (?) not supported
不支持,这是因为以上步骤我是在VMware虚拟机中完成的,换成物理机就没问题,正常情况下是运行后每隔5秒刷现一次
view plaincopy to clipboardprint?
涉及的命令:
cp -r papi-3.6.0 /opt/
cp linux-2.6.20.tar.gz /usr/src/kernels
cd /usr/src/kernels
tar zxvf linux-2.6.20.tar.gz
cd linux-2.6.20
#make clean <当前内核未编译过时不需要执行该命令>
#make mrproper <当前内核未编译时不需要执行该命令>
/opt/papi-3.6.0/src/perfctr-2.6.x/update-kernel
cp 当前内核目录/.config . <复制当前内核下的.config文件到当前目录>
make menuconfig
做如下选择:
(1)Processor type and features选项下的Performance-monitoring counters support,即要支持硬件计数器
(2)搜索 APIC 选项,查看是否已经选上y,没有则选上
(也可以在退出 menuconfig 后使用 grep APIC .config 查询APIC相关选项是否是y)
退出 menuconfig,保存。
make modules
make modules_install
make bzImage
make install
完毕后选择新内核重新启动
新内核启动后
modprobe perfctr
lsmod | grep perfctr
cd /opt/papi-3.6.0/src/perfctr-2.6.x/
make
examples/perfex -i
examples/global/global 检测perfctr是否能正常运行,若出现错误,重启系统
mknod /dev/perfctr c 10 108
chmod 644 /dev/perfctr
make PREFIX=/usr/local install 将perfctr的头文件、库、可执行命令安装到/usr/local下