配置內核支持PERF
make menuconfig
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y
這兩項不知道在 menuconfig中怎麼找,但是可以在make menuconfg保存退出後,vi到.config中查找配置。
General setup->
Kernel Performance Events And Counters --->
[*] Kernel performance events and counters
[ ] Kernel performance counters (old config option)
[ ] Debug: use vmalloc to back perf mmap() buffers
配置此項即為配置.config中如下兩項
CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS=y
.config 中相關的配置如下
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y
#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_PERF_COUNTERS is not set
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
CONFIG_VM_EVENT_COUNTERS=y