当前位置: 首页 > news >正文

广州网站设计联系方式/企业软文营销发布平台

广州网站设计联系方式,企业软文营销发布平台,wordpress4.9.2,教育培训平台转载 1 oprofile 相关介绍 Oprofile是用于Linux的若干种评测和性能监控工具中的一种。它可以工作在不同的体系结构上,包括IA32、IA64和AMD Athlon 系列。它的开销小,将被包含在(Linux)2.6版的内核中。 Oprofile可以帮助用户识别诸…
转载

1 oprofile 相关介绍

Oprofile是用于Linux的若干种评测和性能监控工具中的一种。它可以工作在不同的体系结构上,包括IA32、IA64和AMD Athlon 系列。它的开销小,将被包含在(Linux)2.6版的内核中。

              Oprofile可以帮助用户识别诸如循环的展开、高速缓存的使用率低、低效的类型转换和冗余操作、错误预测转移等问题。它收集有关处理器事件的信息,其中包括TLB的故障、停机、存储器访问、位于DCU(数据高速缓存单元)中的总线路数、一个DCU故障的周期数,以及不可高速缓存的和可高速缓存的指令的获取数量。Oprofile是一种细粒度的工具,可以为指令集或者为函数、系统调用或中断处理例程收集采样。Oprofile通过取样来工作。使用收集到的评测数据,用户可以很容易地找出性能问题。

Oprofile工具概述:

      op_help:列出可用的事件,并带有简短的描述

      opcontrol:控制Oprofile的数据收集

      oprofpp:检索有用的评测数据

      op_time:为系统上的所有映像列出相关的评测值

      op_to_source:产生带注解的源文件、汇编文件或源文件和汇编文件的混合

op_merge:合并属于同一个应用程序的采样文件

op_import:将采样数据库文件从外部格式(abi)转换为本地格式

opreport:显示分析结果

 

2 oprofile的移植


2.1相关资源

源码包:

    Oprofile-0.9.4.tar.gz

    gettext-0.18.1.1.tar.bz2

    buildroot-2010.02.tar.bz2

    Popt-1.7.tar.gz

    Binutils-2.19.51.0.3.tar.bz2

    busybox-1.8.1.tar.bz2

    linux-2.6.29-android-1.0_r1.tar.gz

编译工具:

            arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

 

      2.2详细步骤:

 

         1.在交叉编译之前需要做的一些工作:

(1)打开内核的Oprofile选项

           通过make menuconfig=>general setup=>

           [*] Profiling support (EXPERIMENTAL)                                                      

           [ ]Activate markers                                                                     

           [*] OProfile system profiling (EXPERIMENTAL)

(2)选择安装交叉编译链

                  修改~/.bashrc添加arm-none-linux-gnueabi的路径。

PATH=$PATH: /home/cuiyan/work/arm-2008q3/bin/

(3)配置编译、链接参数

$:export CC=arm-none-linux-gnueabi-gcc

          $:export CXX=arm-none-linux-gnueabi-g++

$:export CFLAGS=-static

$:export CXXFLAGS=-static

$:export CPPFLAGS=-staitc

 

2交叉编译popt库

          $:cd /home/cuiyan/work/oprofile/popt/

          $:tar xfz gettext-0.18.1.1.tar.bz2

          $:cd gettext-0.18.1.1

          $:./configure–prefix=/usr

          $:make

          $:make install

          $:cd ../

 

$:tar xfz popt-1.7.tar.gz

$:cd popt-1.7

$:./configure --with-kernel-support --host=arm-none-linux-gnueabi

--prefix=/home/cuiyan/work/oprofile/popt/poptinstall/

$:make

$:make install

$:cp/home/cuiyan/work/oprofile/popt/poptinstall/lib/* /home/cuiyan/work/arm-2008q3/arm-none-linux-gnueabi/lib

$:cp/home/cuiyan/work/oprofile/popt/poptinstall/include/* /home/cuiyan/work/arm-2008q3/arm-none-linux-gnueabi/include

 

3静态交叉编译binutils

        $:cd /home/cuiyan/work/oprofile/binutils/

        $:sudo apt-get install makeinfo

 

$:tar jxf binutils-2.19.51.0.3.tar.bz2

$:cd binutils-2.19.51.0.3

$:./configure --with-kernel-support --host=arm-none-linux-gnueabi

--prefix=/home/cuiyan/work/oprofile/binutils/binutils-install/

$:make

$:make install

$:cp/home/cuiyan/work/oprofile/binutils/binutils-install/lib/* /home/cuiyan/work/arm-2008q3/arm-none-linux-gnueabi/lib

$:cp/home/cuiyan/work/oprofile/binutils/binutils-install/include/* /home/cuiyan/work/arm-2008q3/arm-none-linux-gnueabi/include

 

4静态交叉编译oprofile

      $:cd /home/cuiyan/work/oprofile/oprofile/

$: tar zxf oprofile-0.9.4.tar.gz

$:cd oprofile-0.9.4

$:/configure--with-linux=/home/cuiyan/mid/gongban/--with-kernel-support 

--host=arm-none-linux-gnueabi

--prefix=/home/cuiyan/work/oprofile/oprofile/oprofile-install

$:make

$:make install

通过1-4操作,可在oprofile-install/bin目录下查看到一些oprofile的工具。

$:bin$ file ophelp

ophelp: ELF32-bitLSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped。

5转换动态链接为静态链接

虽然在之前指定了static参数,但是编译出来的结果仍然是动态链接的。这个是因为Oprofile在链接库时运用到了libtool工具。对于如何通过对libtool文件的修改使其直接产生静态链接的文件,目前未进行研究,而是直接手动编译成静态。

具体方法如下:

就ophelp命令来讲:

$:oprofile-0.9.4$ cd utils/

$:utils$ ls

Makefile  Makefile.am  Makefile.in  opcontrol  ophelp  ophelp.c  ophelp.o

$:utils$ rm ophelp

$:utils$ cd ..

$:oprofile-0.9.4

$ make

注:由于ophelp被删除,则它要重新生产,在make过程中可以查看相关生成指令。

arm-none-linux-gnueabi-gcc-W -Wall -fno-common -Wdeclaration-after-statement -o ophelp ophelp.o ../libop/libop.a ../libutil/libutil.a /work/popt/popinstall/lib/libpopt.so-liberty -ldl   -Wl,--rpath -Wl,/work/popt/popinstall/lib -Wl,--rpath-Wl,/work/popt/popinstall/lib

 

$:oprofile-0.9.4$ cd utils/

$:utils$ rm ophelp

$:utils$ arm-none-linux-gnueabi-gcc -W -Wall -fno-common-Wdeclaration-after-statement -o ophelp ophelp.o  ../libop/libop.a ../libutil/libutil.a /work/popt/popinstall/lib/libpopt.a-liberty -ldl   -Wl,--rpath -Wl,/work/popt/popinstall/lib -Wl,--rpath-Wl,/work/popt/popinstall/lib –static

$:utils$ file ophelp

ophelp: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped

则ophelp为静态链接,不依赖库,可以直接在开发板上运行。其他Oprofile指令相应通过手动编译生成。除其中opcontrol为shell脚本,是源码包自带的。

 

6移植busybox

由于要运用oprofile工具,必须先运用opcontrol进行初始化工作。而opcontrol是个shell脚本。首先修改opcontrol文件。

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

把oprofile工具放在实验板的/sbin目录下。

Export PATH=$PATH:/sbin

$:./opcontrol –init

出现错误:

test: not found

id: not found

test: not found

grep: not found

test: not found

grep: not found

test: not found

test: not found

test: not found

…………

这是由于android提供的命令过于精简,因此需要移植busybox,来运行opcontrol。

通过下载busybox最新版本,进行交叉编译。我的实验板已有busybox工具,所以没有再次移植。以下简要介绍busybox的移植步骤(仅供参考):

(1)在主机上交叉编译busybox,要在make menuconfig中选择静态链接

(2)把busybox复制到实验板的/data/busybox/下。

#:cd /data/busybox

#:chmod +x busybox

#:export PATH=$PATH:/data/busybox/

#:./busybox -install


修改opcontrol文件:

BINDIR =”/data/busybox”

PATH中加入/data/busybox

 

7 oprofile初始化

#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

解决方法:

#rm /etc/mtab

#touch /etc/mtab

#vi /etc/mtab

编辑以下内容:

nodev  /dev/oprofile oprofilefs  rw 0 0

重新执行:

#opcontrol  --init

到此,oprofile移植成功。


有时在mtab文件已经存在的情况下还会出现以下错误:

cat: can't open '/dev/oprofile/cpu_type': No such file or directoryUnable to open cpu_type file for readingMake sure you have done opcontrol –initcpu_type 'unset' is not valid you should upgrade oprofile or force the use of timer mode

解决方法:
Step1:重新启动target
step2:执行# ./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
Step3: 删除/etc目录下的mtab文件
          rm-f /etc/mtab
Step4:执行# ./opcontrol --init
       显示:
       # ./opcontrol --init
       grep: /etc/mtab: No such file or directory
       grep: /etc/mtab: No such file or directory
Step5:重新在/etc/目录下创建mtab并添加“nodev /dev/oprofile oprofilefs rw 0 0”
         touch /etc/mtab
         Vi /etc/mtab
         Insert  "nodev /dev/oprofile oprofilefs rw 0 0"   --->在mtab中添加的内容
Step6:执行# ./opcontrol --init
         ok

 

3 oprofile的相关应用

 

(1)相关命令

#opcontrol--init    

--->During initialization phase, the command can load oprofile.ko module in to kernel, and mount oprfilefs. After that, some files and directories are exported in to /dev/oprofile, such as: cpu_type, dump, enable, pointer_size, stats as so on.

 

# opcontrol --setup --no-vmlinux

--->Configure OProfile not to inspect kernel, if necessary, assign kernel with command : ./opcontrol –setup–vmlinux= /path/to/kernel

 

# opcontrol --start

--->Start up OProfile daemon routine oprofiled, which writes sampled data to /var/lib/oprofile/samples/,  the log file is located at /var/lib/oprofile/oprfiled.log

 

# opcontrol --dump

--->The purpose of this command is to read all the sampled data to /var/lib/oprofile/samples/ before the analysis of performance.

 

#opcontrol--stop

--->The purpose of this command is to stop data coollection

 

#opcontrol–shutdown

--->The purpose of this command is to stop data coollection and kill daemon

 

#opcontrol–reset

--->The purpose of this command is to clear out data from current session

 

#opcontrol–deinit

--->The purpose of this command is to unload the oprofile module and oprofilefs

 

(2)详细应用步骤

a)没有指定内核下的性能监测:

#opcontrol --init

# opcontrol --setup  --no-vmlinux

# opcontrol –start

# opcontrol --dump

# opreport

 

b)指定内核的情况下性能监测:
将编译内核时生成的vmlinux文件复制到sdcard/kernel/目录下。

#opcontrol --init

# opcontrol --setup --vmlinux=/sdcard/kernel/vmlinux

objdump: not found

objdump: not found

The specified file /sdcard/kernel/vmlinux does not seem to be valid

Make sure you are using the non-compressed image file (e.g. vmlinux not vmlinuz)

分析:

参看oprocontrol源码,由于在指定内核镜像时,会用到objdump应用程序检测镜像中的.text段内容,而在开发板上面没有交叉编译的objdump应用程序,所以不能通过判断,以至于,即使指定的是未压缩的内核镜像,也被误认为压缩的了。

解决方法:

通过采用编译静态链接ophelp的具体方法,编译生成静态链接的objdump,然后将binutils-2.19.51.0.3/binutils下的objdump拷贝到开发板的/sbin目录下

重新执行:

#opcontrol --setup --vmlinux=/vmlinux

#opcontrol-start

#opcontrol–dump

#opreport

http://www.lbrq.cn/news/1308025.html

相关文章:

  • 同一个域名两个网站/淘宝关键词推广
  • asp 网站图标/整站seo排名外包
  • 教育在线网站怎样做直播/google app
  • 做一个网站需要多少时间/优化外包服务公司
  • 电商小程序需要什么资质/杭州seo关键字优化
  • 网站后台 设计/seo顾问服务 品达优化
  • 站长工具官方网/手机如何创建网站
  • 外贸做网站的好处/seo优化工作有哪些
  • 正能量网站推荐免费下载/宣传产品的方式
  • 1 企业网站的一般内容是什么/青岛seo推广
  • 网站建设公司杭州/营销推广是什么
  • 隆尧建设局网站/宁波网站seo哪家好
  • 建设执业资格注册中心官方网站/广告公司招聘
  • 墨玉县建设工程信息网/深圳seo关键词优化外包公司
  • wordpress搬家插件/上海公司网站seo
  • 微信获客crm平台/湖南seo推广服务
  • 制作网站详细步骤/怎么做app推广和宣传
  • 杭州商城型网站建设/今日国内新闻大事
  • 洞泾做网站/大二网络营销实训报告
  • 杭州公司网站设计/建设网站公司
  • 政府部门网站建设规定/企业排名优化公司
  • 国外怎么做直播网站吗/品牌策划推广方案
  • 建湖专业做网站的公司/外贸网站平台哪个好
  • 哈尔滨免费做网站/兰州seo网站建设
  • 在虚拟主机上建设多个网站/微信指数怎么看
  • 找人做网站昆明/站长统计app进入网址新版小猪
  • 网站没备案可以做淘宝客吗/外包公司为什么没人去
  • phpcms仿站教程/河北网站建设制作
  • 网站开发近期市场/软文类型
  • google play/seo专员岗位职责
  • 小红书获取关键词列表API接口详解
  • 数据结构:集合操作(Set Operations): 并集(Union)、交集(Intersection)、 差集(Difference)
  • Install Docker Engine on UbuntuMySQL
  • JAVA中的Collection集合及ArrayList,LinkedLIst,HashSet,TreeSet和其它实现类的常用方法
  • 《图解技术体系》Four Implementation Methods of Distributed Transactions
  • UniApp 多端人脸认证图片上传实现