zoukankan      html  css  js  c++  java
  • 和菜鸟一起学linux之linux性能分析工具oprofile移植


    一、内核编译选项

    make menuconfig

    General setup--->
    [*] Profiling support
    <*> OProfile system profiling


    二、popt移植

           下载源码:http://rpm5.org/files/popt/    popt-1.16.tar.gz

     

           解压缩后,在popt-1.16当前目录下,新建build.sh,编辑内容如下:

    ---------------------------------------分割线----------------------------------------------------

    #!/bin/sh 
    ./configure  --host=arm-linux  
                     --prefix=/home/eastmoon/rootfs 
    --target=arm-linux
     

    ---------------------------------------分割线----------------------------------------------------

    设置下build.sh的权限后,

    ./build.sh 配置好以后,

    make下,

    再make install就ok了。

    然后可以看到在/home/eastmoon/rootfs中就会有相关的.so等库了。


    二、binutils移植

    下载源码:http://ftp.gnu.org/gnu/binutils/   binutils-2.22.tar.gz

     

    解压缩后,在binutils-2.22当前目录下,新建build.sh,编辑内容如下:

    ---------------------------------------分割线----------------------------------------------------

    #!/bin/sh 
    ./configure  --host=arm-linux  
                     --with-kernel-support 
                     --prefix=/home/eastmoon/rootfs 
    --target=arm-linux 
    --disable-nls


    ---------------------------------------分割线----------------------------------------------------

    设置下build.sh的权限后,

    ./build.sh 配置好以后,

    修改gas/Makefile,WARN_CFLAGS中去掉-Werror

    因为有些机器是64位的,编译的.a在oprofile中链接会有问题。所以,这时候

    vim config.status

    修改$[“CFLAGS”]=”-g–O2” 为 $[“CFLAGS”]=”-g–O2  -fPIC”.

     

    接着

    make下,

    再make install就ok了。

    然后可以看到在/home/eastmoon/rootfs中就会有相关的.so等库了。

     


    三、oprofile移植

    下载源码:http://oprofile.sourceforge.net/download/    oprofile-0.9.9.tar.gz

     

    解压缩后,在oprofile-0.9.9当前目录下,新建build.sh,编辑内容如下:

    ---------------------------------------分割线----------------------------------------------------

    #!/bin/sh 
    CFLGAS+=-I//home/eastmoon/rootfs/include 
    CXXFLGAS+=-I//home/eastmoon/rootfs/include
    LDFLGAS+=-L//home/eastmoon/rootfs/lib 
    ./configure  --host=arm-linux  
                     --with-kernel-support 
                     --prefix=/home/eastmoon/rootfs 
    --target=arm-linux 
     

    ---------------------------------------分割线----------------------------------------------------

    设置下build.sh的权限后,

    ./build.sh 配置好以后,

    接着

    make下,

    再make install就ok了。

    然后可以看到在/home/eastmoon/rootfs中就会有相关的应用程序了。

     

    四、应用

    编译的时候有指定的OPROFILE_EVENTS_DIR的路径。所以,在使用的时候

    export  OPROFILE_EVENTS_DIR=’/home/oprofile’

     

           把/home/eastmoon/rootfs/share/oprofile下的文件,拷贝到/home/oprofile下。

     

    最后,就可以使用oprofile了

    opcontrol –setup–no-vmlinux

            opcontrol –init

            opcontrol –start  //启动

            opcontrol –dump  //采集

        opcontrol –stop   //停止

        opreport     //查看

        opreport –l   //查看,包括函数

    具体的其他功能可以百度查看,这里只是移植和简单的应用。

  • 相关阅读:
    C#开发Activex控件疑难杂症
    spring、struts、mybatis、Postgresql集成使用存储过程进行分页
    C#开发Activex控件升级
    通过Maven将Web程序部署到远程Tomcat8服务器的一些注意事项
    分页存储过程Oracle版
    JSP EL表达式(转)
    关于Log4x
    C#类在初始化时的执行顺序
    使用MSMQ 远程队列
    tomcat部署与Context(转)
  • 原文地址:https://www.cnblogs.com/wuyida/p/6299996.html
Copyright © 2011-2022 走看看