Intel Vtune 嵌入式移植

来源:互联网 发布:疯狂的美工装修助手 编辑:程序博客网 时间:2024/05/06 00:11

Intel的性能优化工具Vtune对于我来说十分强大。在Linux发布版本中很容易安装使用。但在裁剪的嵌入式系统中安装很容易产生这样或那样的问题。本文只针对特定情况。

  • 嵌入式开发机环境为Fedora-16(64 bit)
  • 嵌入式系统内核为2.6.32,及其他

Linux Fedora-16虚拟机上安装

可能的错误处理

文件路由有Windows的格式如 “Intel Vtune”,中间有空格。在执行install.sh的时候会出现错误。修改路径名,如空格改为下划线。

执行

sudo -ssource /opt/intel/vtune_amplifier_xe_2016.2.0.444464/amplxe-vars.shamplxe-cl -collect hotspots ./a.outctrl-c

分析

当前目录下会生成新的r000hs目录

命令行方式

amplxe-cl -report hotspots -r r000hs 

界面方式

amplex-gui

然后导入结果即可


向嵌入式系统移植

可执行文件默认安装路径

/opt/intel/vtune_amplifier_xe_2016.2.0.444464/bin64/

查看amplxe-cl依赖库(大致看一下用不到)

ldd amplxe-cl

依赖很多库,多数库是软件自己带的,这样应该会好移植一点

遇到的错误及解决


Error 1

./install.sh: line 454: hostname: not foundError: No write permissions to "/tmp" temporary download folder.Please fix the permissions or provide another temporary download folder.To provide another temporary folder please run installationwith "--download-dir [FOLDER]" parameter.

开始没有仔细找到根本原因是按以下方法修改(不可行)

vi install.sh:455//hostname 随便换个名字 host-zqmkdir /doc/zq//实际有权限以下提示忽略Please fix the permissions or provide another temporary// for tmp dirdelete line 555: exit $EXIT_CODE_CHANCLE// for download dirdelete line 570: exit $EXIT_CODE_CHANCLE//不退出继续编译

change method

mkdir /doc/zq//实际有权限以下提示忽略Please fix the permissions or provide another temporary//通过阅读脚本install.sh,是由于自己的嵌入式系统中没有过rmdir命令导致测试时出错touch_space 函数中rmdir,改为rm -rf

执行

cd CLI_Install./install.sh --download-dir /doc/zq --tmp-dir /doc/zq 

Error 2

--------------------------------------------------------------------------------Please type the full path to the installation root directory starting with /Suffix "/vtune_amplifier_xe_2016.2.0.444464" will be added automatically: /do/doc/i/doc/intel_vtuneERROR: No write permissions to destination directory.

change method

//脚本中可以将rmdir  改成 rm -rf 但后续脚本会继续调用其它脚本或程序,rmdir的位置不好找了,直接增加一个拷贝rmdir 命令(或者从开发及拷贝rmdir到嵌入式系统)或者/bin 下增加一个脚本//filename = rmdir#!/bin/shrm -rf $*

Error 3

Each component will be installed individually. If you cancel the installation,some components might remain on your system. This installation may take several minutes, depending on your system and the options you selected.--------------------------------------------------------------------------------Installing Command line interface component...sh: cpio: not foundERROR: Unable to extract data from RPM package. Please check that temporarydirectory is not full.--------------------------------------------------------------------------------Failed to install packageintel-vtune-amplifier-xe-2016-cli-16.2-444464.i486.rpmWould you like to stop the installation?(Yes/No)[Yes]: 

change method

问题的关键是Installing Command line interface component...sh: cpio: not foundERROR: Unable to extract data from RPM package. Please check that temporarydirectory is not full.也就是cpio找不到因而从Federa-16上拷贝cpio到/bin目录 其实和上边的原理相同

Error 4

Missing optional prerequisites-- Unsupported OS-- Driver build options are incomplete. Drivers cannot be built.-- Cannot detect glibc library-- /usr/local/share directory is not writable. Trial activation option may notwork.-- /opt directory is not writable. Activation may not work.

change method

增加这两个路径{我是在doc[不必在意这是我的系统下的一个目录]下建的路径  然后ln -s软链的过去}

oether warning 但会不会终端安装

缺少mktemppgrep跟上边一样拷贝

完成



配置环境变量

source /doc/intel_vtune/vtune_amplifier_xe_2016.2.0.444464/amplxe-vars.sh配置环境变量,如果没有amplex-var.sh这个脚本可能没有看成功,但是对我的系统来说由于是裁剪的嵌入式系统设置这些环境变量不生效。没关系直接去二进制文件目录执行可执行程序就可以了。

其实还没有完成

still error

amplxe: Warning: Skipped generation of report `summary': no valid license can be found (License file is not found. Make sure that your license file is in the correct location and readable.Tip: Consider setting the license file location with the INTEL_LICENSE_FILE environment variable.).

change method
没有授权文件

cp $somewhere/permanen.lic $HOME/intel/licenses

that would be OK!!!


更多-嵌入系统硬件基于事件的采样驱动安装

嵌入系统上没有gcc编译环境,不能编译驱动源码安装,因而不能自己安装驱动成功。需要在虚拟机上编译好驱动模块。然后再嵌入式系统上安装。

see: $install_dir/documentation/en/help/index.htm#GUID-92B13766-1617-44D0-BA70-AC61F5833CA4.htm

步骤1: 现在虚拟机上编译驱动源码

由于在虚拟机上默认安装过程中,这个驱动是无法安装的,因而在安装过程中启动源码也没有被编译(实体机上会默认安装这个驱动)。首先在虚拟机上编译。

首先需要配置编译驱动的需要的内核环境,为了简单起见将开发机上编译好的内核代码以及源码打包放在虚拟机上。

如放在/kernel_some/kernel/目录,其中要包含源码以及编译出来的内核镜像vmlinux

然后编译启动需要指定参数

cd $install_dir/sepdk/src./build-driver -ni --kernel-file=/kernel_some/kernel/vmlinux --kernel-src-dir=/kernel_some/kernel --kernel-version=2.6.32.27 

编译成功

或者按照下边的方法(没有验证)

先将嵌入系统中使用的内核代码拷贝到虚拟机上包括配置文件(见下)边编译内核,然后再起驱动目录按照上边的命令编译驱动

//编译内核需要内核配置选项scripts/x86_64/kernel-2.6.32.x-config我们的Makefile中$(KERNEL_OUTPUT)/.config: $(SRCTREE)/scripts/$(BUILD_ARCH)/$(KERNEL_CONFIG)@cp $^ $@ $@代表目标文件 $(KERNEL_OUTPUT)/.config$^待变依赖文件 $(SRCTREE)/scripts/$(BUILD_ARCH)/$(KERNEL_CONFIG)也就是交依赖文件拷贝到目标文件的地方

生成 **.ko


步骤2: 将虚拟机上的驱动拷贝到嵌入式系统

为保险起见将整个src目录覆盖到嵌入式设备上$install_dir/sepdk/src目录下(先在虚拟机上对src目录打包,拷贝到嵌入式系统后解压)

步骤3: 嵌入系统上安装驱动

cd <install_dir>/sepdk/src./insmod-sep3 -r

错误1:

Warning:  no sep3_15 driver was found loaded in the kernel.ERROR: unable to find command "pgrep" !ERROR: unable to find command "su" !Please add the above commands to your PATH and re-run the script ... exiting.

修改1:

拷贝pgrep可执行文件到/bin由于嵌入式系统只有一个root用户。在/bin下建立一个名为su的脚本就可以,这个脚本不需要做任何事//filename: su//path /bin//内容/#!/bin/sh

然后就OK了。


Attach:

有用的脚本和命令

#!/bin/shmkdir /intelmkdir /intel/licensescp /doc/permanent.lic /intel/licensesln -s /doc/opt optcp /doc/su /bin/sucp /doc/pgrep /bin/pgrep/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/sepdk/src/insmod-sep3 -r
/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect concurrency -knob enable-user-tasks=true -knob enable-user-sync=true  -- ./myapp /doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect hotspots -- ./myapp/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect advanced-hotspots -knob collection-detail=stack-samping -target-duration-type=long -knob sampling-interval=10  -- ./myappadvanced-hotspots/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect advanced-hotspots -knob collection-detail=stack-call-and-tripcount -target-duration-type=long -knob sampling-interval=10  -- ./myapphpc/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect hpc-performance -knob enable-stack-collection=true -knob collect-memory-bandwidth=false -target-duration-type=long -knob sampling-interval=10  -- ./myappmicro arch/doc/intel_vture/vtune_amplifier_xe_2016.2.0.444464/bin64/amplxe-cl -collect general-exploration -knob dram-bandwidth-limits=false  -target-duration-type=long  -- ./myapp

Contact: bigjordon@163.com

0 0