因查找linux系统下 kworker占用过高的原因,用perf工具来分析。

perf为 linux kernel自带的性能检测工具。

在linux3.10内核下编译perf工具。

首先perf是linux内核发行版自带源码工具,需要内核开启某些选项支持,具体哪些选项,百度。

1. cd 到 kerne/tools/perf路径下

2.

    export PATH=/home/huanghm/work/dsp_rv1108/prebuilts/toolschain/usr/bin:$PATH

    export CROSS_COMPILE=arm-linux-

    export ARCH=arm

3.打开perf下的Makefile文件,找到

ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
        FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
        ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
                LIBC_SUPPORT := 1 
                $(warning  $(ARCH))
        endif
        ifeq ($(BIONIC),1)
                LIBC_SUPPORT := 1 
                $(warning  $(ARCH))

        endif

在endif末尾加上LIBC_SUPPORT := 1 

于是变成

ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
        FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
        ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
                LIBC_SUPPORT := 1 
                $(warning  $(ARCH))
        endif
        ifeq ($(BIONIC),1)
                LIBC_SUPPORT := 1 
                $(warning  $(ARCH))
        endif

        LIBC_SUPPORT := 1

4.执行make,就能成功编译出perf。

    file perf
    perf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, not     stripped

Logo

更多推荐