Oprofile 常见问题

    技术2023-03-28  54

    1.       oprofile源码中的opcontrolandroid上出错

    opcontrol要在android上跑起来,需要修改一下

    1 #!/bin/sh  改为  1 #!/system/bin/sh

     

    1115             tmp="${1/cell/CELL}"

    1116             if test "$1" = "$tmp"; then

    1117             #No substituion occurred, so cputype is not cell

    将上面三行改为

    1115             #tmp="${1/cell/CELL}"

    1116             #if test "$1" = "$tmp"; then

    1117             #No substituion occurred, so cputype is not cell

    1118             if echo $1|grep -q cell;then

     

    1243  len=`echo -n $event_num | wc -m` 改为1244  len=`echo -n $event_num | wc -c`

     

    1970     BINDIR="/usr/bin" 改为  1971     BINDIR="/data/busybox"

     

    1975 PATH=$OPDIR:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin 改为

    1975PATH=$OPDIR:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/data/busybox:$PATH

    2.       Cannot create directory /dev/oprofile: File exists do_setup failed错误是什么意思?

    Oprofile没有编译进kernel,检查kernel的编译选项

    3  为什么输入opcontrol没有显示帮助信息?

           Android已经自带了opcontroloprofiled,/system/xbin目录中,自带的版本比较老不好用。不过我们可以用自带的opcontrol来检测kernel是否支持oprofile.如果运行opcontrol --quick没有错误的话,就说明当前的内核支持oprofile。之后只用修改path,指向我们新版本的oprofile即可。Export PATH=/data/oprofile/bin:$PATH

    4.     # ./opcontrol --init

      grep: /etc/mtab: No such file or directory

      grep: /etc/mtab: No such file or directory

    Kernel support not available, missing opcontrol --init as root ? 错误怎么解决?

    # mount -o remount rw /

    # mount -o rw,remount -t yaffs2 /dev/mtdblock3 /system

    # touch /etc/mtab

    # echo nodev /dev/oprofile oprofilefs rw 0 0>/etc/mtab

     

    5. #./opcontrol --init

    Kernel support not available, missing opcontrol --init as root ? 错误怎么解决?

    检查/etc/mtab文件内容,确保是nodev /dev/oprofile oprofilefs rw 0 0

     

    6.  # opcontrol --init           

    opcontrol --init

    cat: can't open '/dev/oprofile/cpu_type': No such file or directory

    Unable to open cpu_type file for reading

    Make sure you have done opcontrol --init

    cpu_type 'unset' is not valid

    you should upgrade oprofile or force the use of timer mode  错误怎么解决?

    执行

    # mount -t oprofilefs nodev /dev/oprofile

    7.  # opcontrol --start

    mkdir: can't create directory '/var/': Read-only file system

    Couldn't mkdir -p /var/lib/oprofile   错误怎么解决?

    执行

    # mount -o remount rw /

    8.  oprofile使用步骤

    opcontrol --init //初始化oprofile运行环境,开机后只需要做一次

    opcontrol --session-dir=/data/result --no-vmlinux //配置oprofile运行参数

    opcontrol --start  //启动侦听

    运行被测程序

    opcontrol --dump //收集测试数据

    opcontrol --stop   //停止侦听

    opcontrol --shutdown  //关闭oprofiled守护程序

    opcontrol --reset  //清空测试数据

    8.  参考资料

        Oprofileomap上的使用

             http://www.omappedia.com/wiki/Android_Debugging

        使用oprofile分析嵌入式linux性能(一)

    http://hi.baidu.com/rocketchen/blog/item/012cc639aa58c5f93b87ce06.html

    使用oprofile分析嵌入式linux性能(二)

    http://hi.baidu.com/rocketchen/blog/item/ca05bc51a1ba4b858d54300a.html

    使用oprofile分析嵌入式linux性能(三)

    http://hi.baidu.com/rocketchen/blog/item/ea3b42da1ba3c6d1b7fd4816.html

    官方文档

    http://oprofile.sourceforge.net/doc/index.html

    最新回复(0)