首页 技术经验

Streamline安装与入门使用【streamline】 - streamline

streamline Streamline安装 入门使用

  写在最前

  Streamline是一个arm的profile工具,用于检测CPU和GPU的各种信息,就类似NVIDIA Visual Profiler的工具,这里介绍如何在ubuntu16.04的系统下安装并使用它。

  安装Streamline & adb

  从官网(https://developer.arm.com/products/software-development-tools/ds-5-development-studio/streamline)下载Streamline的包,然后运行安装。

  安装adb:sudo apt-get install android-tools-adb

  生成license

  安装好了之后打开Eclipse for DS5,然后Help->Arm License Manager,点击add license的按钮,根据提示就可以获得一个30天的license了。获得之后如下图:

生成license

  ps : 这里还遇到了一个问题,就是由于电脑开了代理,在认证的时候说找不到网络,需要在eclipse里设置Window -> Preferences ->General -> Network Connections把 自动 设置成 手动 就可以了

  启动Streamline连接手机

  完成上一步之后关闭eclipse打开streamline

  在 /usr/local/DS-5_v5.29.1/sw/streamline/android找到streamline-daemon-app.apk这个apk文件然后把这个东西安装在手机上。

  手机连接电脑(需要打开usb调试选项),然后打开刚刚装的app

然后打开刚刚装的app

  使用adb devices查看是否有设备,然后点击最左侧的Target选项卡,点击文本框的眼睛选择设备

使用adb devices查看是否有设备,然后点击最左侧的Target选项卡,点击文本框的眼睛选择设备

  这里如果找不到设备,需要在~/.android目录底下新建一个adb-key.ini文件,然后执行lsusb,将设备的位置,也就是下图的12d1,在文件中以0x12d1的形式保存,即可

需要在~/.android目录底下新建一个adb-key.ini文件

  点击左侧红点就可以运行了

点击左侧红点就可以运行了

阅读数
971857
话题:streamline

MATLAB使用Streamline

假设有网格点(可用meshgrid生成):
x=[0.100000000000000 0.300000000000000 0.500000000000000 0.700000000000000 0.900000000000000;
0.100000000000000 0.300000000000000 0.500000000000000 0.700000000000000 0.900000000000000;
0.100000000000000 0.300000000000000 0.500000000000000 0.700000000000000 0.900000000000000;
0.100000000000000 0.300000000000000 0.500000000000000 0.700000000000000 0.900000000000000;
0.100000000000000 0.300000000000000 0.500000000000000 0.700000000000000 0.900000000000000
]
 
y=[0.100000000000000 0.100000000000000 0.100000000000000 0.100000000000000 0.100000000000000;
0.300000000000000 0.300000000000000 0.300000000000000 0.300000000000000 0.300000000000000;
0.500000000000000 0.500000000000000 0.500000000000000 0.500000000000000 0.500000000000000;
0.700000000000000 0.700000000000000 0.700000000000000 0.700000000000000 0.700000000000000;
0.900000000000000 0.900000000000000 0.900000000000000 0.900000000000000 0.900000000000000
]
 
速度场为:
vx=[0.229214927831620 0.484992161649913 0.511542329913037 0.484609968500024 0.228844872405280;
-0.0441202943082050 -0.0948303025763882 -0.101452496351781 -0.0950302781310795 -0.0442877900474820;
-0.0217118809285888 -0.0521377421248146 -0.0608705691976151 -0.0522086930579819 -0.0217639850565926;
-0.0123090147301853 -0.0311455020402544 -0.0376810417890673 -0.0311707392893143 -0.0123261848103161;
-0.00869129734190032 -0.0224577351294126 -0.0275367893705573 -0.0224689233381604 -0.00869857175511532
]
 
vy=[-0.0868719439647464 -0.0268738327712380 -2.77415243808460e-05 0.0267980076306113 0.0869986785111828;
-0.129597596040084 -0.0471910714669598 -6.08331481452978e-05 0.0470626960890551 0.129787171960516;
-0.0637302533469612 -0.0319189737689416 -4.54528108274030e-05 0.0318524807937719 0.0638140860309378;
-0.0296962608107631 -0.0166756772240747 -1.62538153610997e-05 0.0166581026029832 0.0297235159044604;
-0.00869165953913994 -0.00507394215085496 -3.89262829814857e-06 0.00507031026765506 0.00869792332285582
]
在使用streamline时,按照(x网格点,y网格点,x方向速度,y方向速度,x起始点向量,y方向起始点向量),如startx=ones(1,10)*0.5;
starty=0.1:0.1:1.0;
streamline(x,y,vx,vy,startx,starty);
 
解释:starty=0.1:0.1:1.0;表示流线的起始纵坐标是0.1,间隔0.1,终到1.0,即y=0.1,0.2,0.3…1.0都要划流线。startx=ones(1,10)*0.5表示每根流线的起始x坐标。两句在一起表示,(x,y)=(0.1,0.5)处开始画流线一根,(x,y)=(0.2,0.5)处开始再画一根流线,(x,y)=(0.3,0.5)处开始继续画流线一根…所以要求x的个数与y的个数相同。画出来类似这样:
MATLAB使用Streamline

嵌入式开发之Streamline性能剖析环境搭建

  嵌入式开发之Streamline性能剖析环境搭建

  参考文档

  搭建ARM DS-5 Streamline

  编译Mainline_U-boot_and_Linux

  在介绍具体的安装步骤之前先列举一下开发环境相关参数,这样做是为了避免忽略因为开发环境不一致导致的错误

  芯片:Allwinner H3(Nano pi neo)

  目标器件Linux发行版本:Ubuntu core 16.04.2

  目标器件Linux内核版本:4.11.2

  工具链版本:arm-cortexa9-linux-gnueabihf-4.9.3

  DS-5版本:5.27.0

  主机操作系统版本:Ubuntu14.04 64位

  Streamline是DS-5内置的一个性能分析器性能分析器,属于DS-5的付费功能,所以在使用DS-5附带的streamline功能前需要购买DS-5旗舰版本的软件许可或者申请试用30天有效期的试用许可

  安装DS-5

  获取软件许可证

  设置交叉编译链

  # 设置交叉编译相关参数

  # 本文使用的是全志提供的交叉工具链,存放位置为/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3(更改为你正在使用的目录)

  # Allwinner H3 NanoPI Neo cross compiler (社区主线linux4.11)

  export ARCH=arm

  export PATH=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/:$PATH

  export CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-

  export CC=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-gcc

  export CXX=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-g++

  export LD=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ld

  export AR=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ar

  export AS=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-as

  export RANLIB=/opt/toolchain/arm-cortexa9-linux-gnueabihf-4.9.3/bin/arm-cortexa9-linux-gnueabihf-ranlib

  重新编译Linux内核

  进入linux源代码目录

  make sunxi_defconfig ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-

  make menuconfig ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf-

  这里需要先通过make sunxi_defconfig来加载全志的默认参数,然后在这个基础上实用menuconfig界面进行修改

  通过menuconfig界面确认开启如下选项:

  CONFIG_PROFILING

  CONFIG_PERF_EVENTS

  CONFIG_FTRACE

  CONFIG_HIGH_RES_TIMERS

  CONFIG_HW_PERF_EVENTS

  CONFIG_LOCAL_TIMERS

  CONFIG_CPU_FREQ

  CONFIG_TRACING

  确认开启上述选项之后重新编译内核

  从DS-5的安装目录下获取gator驱动程序,ds-5 5.27.0相应的位置是DS-5_v5.27.0/sw/streamline/gator/driver,将driver目录重命名为gator复制到linux源码树的driver目录下。

  修改/linux/driver/Kconfig

  # 在最后增加一行

  source "drivers/gator/Kconfig"

  修改/linux/driver/Makefile

  # 在最后增加一行

  obj-$(CONFIG_GATOR) += gator/

  为了让gator生效,修改/linux/driver/gator/Kconfig

  #修改

  depends on LOCAL_TIMERS || !(ARM && SMP)

  #为

  depends on LOCAL_TIMERS || (ARM && SMP)

  完成内核编译之后会生成如下文件:

  arch/arm/boot/zImage

  arch/arm/boot/dts/sun8i--nanopi-.dtb

  编译gator驱动

  修改/linux/Makefile

  #修改

  KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \

  -fno-strict-aliasing -fno-common \

  -Werror-implicit-function-declaration \

  -Wno-format-security \

  -std=gnu89 $(call cc-option,-fno-PIE)

  #为

  KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \

  -fno-strict-aliasing -fno-common \

  -Wno-format-security \

  -std=gnu89 $(call cc-option,-fno-PIE)

  编译

  make ARCH=arm CROSS_COMPILE=arm-cortexa9-linux-gnueabihf- modules M=drivers/gator

  编译完成之后会生成

  drivers/gator/gator.ko

  编译Gatord

  cd DS-5_v5.27.0/sw/streamline/gator/daemon

  make -j8

  编译完成之后会生成

  gatord

  Streamline使用

  在目标板上启动gatord

  cd /opt

  ./gatord

  启动streamline并连接到目标板

  开始收集性能信息

  分析性能信息

  一、 安装Arm DS-5 软件

  在arm官网注册账号,并下载Arm DS-5。 安装软件后打开 Eclipse for DS-5 v5.?? ,进入Help -> ARM License Manager 可以获取30天的授权。

The configuration
options:
 
CONFIG_MODULES
and MODULE_UNLOAD (not needed if the gator driver is built into the kernel)
CONFIG_GENERIC_TRACER or CONFIG_TRACING
CONFIG_CONTEXT_SWITCH_TRACER
CONFIG_PROFILING
CONFIG_HIGH_RES_TIMERS
CONFIG_LOCAL_TIMERS (for SMP systems and kernel versions before 3.12)
CONFIG_PERF_EVENTS and CONFIG_HW_PERF_EVENTS (kernel versions 3.0 and greater)
CONFIG_DEBUG_INFO (optional, used for analyzing the kernel)
CONFIG_CPU_FREQ (optional, provides frequency setting of the CPU)
CONFIG_MALI_GATOR_SUPPORT (needed as part of Mali Midgard support)

  编译gatord和 gator.ko

  gatord 和 gator.ko 的source code 都在C:\Program Files\DS-5 v5.??\sw\streamline\gator

  编译gator.ko

  仔细阅读其中的README.md,先把gator\driver拷贝到内核\drivers目录,然后按照步骤打开相关Linux Kernel Config.

  make –C kernel_path M=pwd modules)

  1) to_your_kernel_floder

  2) gator/driver kernel/drivers/gator // 若本来有这个目录,建议备份后删除,在拷贝自己的gator/driver

  3)把

  “drivers/gator/Kconfig”>添加到kernel/drivers/Kconfig

  里

  4)make menuconfig //不建议强制修改 .config。但配置好之后可以打开.config 确认 //添加gator.ko,Device

  Drivers —> Gator module for ARM’s

  Streamline Performance Analyzer

  5)make;make modules

  6)获取gator.ko 并丢到开发板里面,insmod /…/gator.ko 并确认正常加载

  二、 编译 gatord

  仔细阅读其中的README.md。若Linux平台直接按照步骤应该应该可以编出来(只需要配置好编译工具链)

  下面介绍编译安卓平台的gatord

  编译安卓平台的gatord 则需要添加 ndk-build 工具,可参考《ubuntu 14 64bit 安装NDK》。

  步骤大致如下:

  wget -c

  http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin

  chmod 777 /…/android-ndk-r10e-linux-x86_64.bin

  /…/android-ndk-r10c-linux-x86_64.bin

  export NDK_HOME=/…/android-ndk-r10e

  export PATH= N D K H O M E : NDK_HOME: NDK

  H

  ​ OME:PATH

  echo $NDK_HOME

  ndk-build -v //可以看到版本信息

  @编译gatord

  1) 拷贝gator/daemon/ 到 安卓目录,如 cp -rvf gator/daemon

  android/jni //按照README.md

  必须重新命名为 jni

  2) 配置安卓编译环境

  “source ./build/envsetup.sh; lunch xxx”

  3) cd android/jni

  4) vi Application.mk //APP_ABI

  := arm64-v8a 活着 APP_ABI := armeabi-v7a,到开发板中 cat /proc/cpuinfo CPU

  architecture: 8 应该用 v8a

  5) ndk-build

  6) 获取

  …/ libs/arm64-v8a/gatord

  7) 把gatord 拷贝到开发板 /system/bin (可选其他目录)

  8) 执行/system/bin/gatord -v 查看到版本即可(gatord &

  gator.ko 和 DS-5 软件版本应该一致)

  三、 Streamline链接开发板

  开发板开机后, 并理解到同一个路由

  ifconfig 获取开发板IP

  insmod /…/gator.ko

  /system/bin/gatord

  打开DS-5 streamline软件,把开发板IP设定到“streamline Data”中,并点击红色按钮即可,如下

打开DS-5 streamline软件,把开发板IP设定到“streamline Data”中,并点击红色按钮即可

  如何分析,请到Arm官网查询相关文件

  常用命令

  adb connect 192.168.1.110

  adb root

  adb connect 192.168.1.110

  adb remount

  adb push /…/gatord /system/bin

  adb push /…/gator.ko /…/modules/

  -Wl,rpath=”/system/lib64”