Performance Data Collection with Sampling Collector

        Sampling Collector (SEP) is a command-line tool for doing hardware-based sampling using event-based sampling (EBS). In this article, we will describe how to use SEP for Tizen* mobile system. The usage model described in this article is also applicable for Tizen* IVI system and other embedded Linux system. However for Tizen* IVI system, or an embedded system with ssh services enabled, using Vtune Amplifier remote data collection with ssh is recommended. You may refer to article How to use remote collection using Intel(R) System Studio for more details for remote performance data collection.

        SEP is normally used in a resource restricted system. You are able to collect the performance data in the target system directly with sep utilities. Once the performance data file is generated, copy the performance data file back to host system and use VTune Amplifier GUI for offline performance analysis.
        The topics we will cover in this article:
             
            
Build the Sampling Drivers
            
Install the SEP on Target System
            
Collect the Performance Data on Target System
            
View the Performance Data on Host System

Build the Sampling Drivers

        The Sampling Collector package is available in the Intel System Studio product release. After installing the Intel System Studio, you can find the system_studio_target.tgz file installed in the <install-dir>/targets folder where <install-dir> is the Intel System Studio installation folder on host system. By default, it is installed on /opt/intel/system_studio_x.y.z/ folder.
        Copy the system_studio_target.tgz file into a directory where you have full access, unpack the file, for example:
            
$ cp /opt/intel/system_studio_x.y.z/targets/system_studio_target.tgz ~/
            
$ cd ~/
            
$ tar xvf system_studio_target.tgz

        You will find the folder in ~/system_studio_target which contains the utilities of each component for target system. Go to ~/system_studio_target/vtune_amplifier_2015_for_systems_target/ folder. This folder contains the source for EBS based sampling drivers and the SEP utilities for target system, for example, for 32bit target system, go to
            $ cd ~/system_studio_target/
vtune_amplifier_2015_for_systems_target/linux32 & ls

          You will find two files, vtune_amplifier_target_sep_x86.tgz and vtune_amplifier_target_x86.tgz.
          vtune_amplifier_target_sep_x86.tgz: contains the sep drivers sources and utilities for SEP which can be used for the natively performance data collection on target system.
          vtune_amplifier_target_x86.tgz: contains the sep drivers sources and utilities for remote data collection. It also supports the natively performance data collection on target system.
         Unpack the tgz file, e.g.
          $ tar zvf  vtune_amplifier_target_sep_x86.tgz
         Go into unpacked folder vtune_amplifier_2015_for_systems_target. The folder sepdk contains the sources for building EBS based sampling drivers. For sep, the driver pax.ko and sep3_x.ko are required.

         The sampling driver is required to use the sep for performance data collection. To build the sample driver on the host system, goto sepdk/src folder, using build-driver script to build the driver. For example,
                $ cd sepdk/src
                $
./build-driver –ni \
                     
--kernel-version="3.4.34-25.1-clovertrail"\
                     
--kernel-src-dir=/path-to-Tizen/kernel-clovertrail/
                     
--make-args="PLATFORM=x32 ARITY=smp”

          You need to prepare your kernel source build environment before building the sampling drivers. Especially for Tizen-mobile system, the signed kernel modules are required. For an existing Tizen-mobile device, if you don’t have the key files which exactly matching your kernel, you may need to rebuild the kernel and flash the new kernel to your device. Please refer to the article “How to build and Install Vtune® Amplifier Sampling Driver for Embedded/Mobile system” for more details on the sampling driver build.

Install the SEP on Target System

         Once the drivers are built successfully in sepdk/src folder, we can push the entire sep folder (vtune_amplifier_2015_for_systems.0.0.362999) to your target system. 
              $sdb vtune_amplifier_2015_for_systems.0.0.362999 /data/sep

         For the embedded linux system, you may copy the folder by using scp, ftp etc if the network is available on target or any methods supported by your target system.

       Once the drivers are uploaded on target system, go to sepdk/src folder on target device, use insmod-sep3 script to load the kernel drivers. For example, for Tizen-mobile system, goto sdb shell for target system and install the drivers.
             $ sdb root on & sdb shell
             $ cd /data/sep/sepdk/src
             $ ./insmod-sep3 -re

        For other embedded system, you may ssh to your target or login to your target shell console directly to install the driver. Please refer to the article “How to build and Install Vtune® Amplifier Sampling Driver for Embedded/Mobile system” for more details on the sampling driver installation.

Collect the Performance Data on Target System

         In the target shell console, go to bin32 or bin64 folder of the sep utilities, set up the runtime environment in current bash shell by adding the directory where sep binary is located into PATH. For example,
               $ cd /data/sep/bin32
     
          $ export PATH=`pwd`:$PATH
      
         $ sep -help

        You can use sep to collect the performance data on the target system. For example, use “$sep -start –d 10” to start a 10 second sampling session with default events. Refer to the output message of “sep -help” and the SEP_Users_Guide.pdf file for more details on the usage of sep binary. The SEP users guide can be found in the directory of Intel VTune Amplifier installation folder, e.g. /opt/intel/system_studio_x.y.z/vtune_amplifier_x_for_system/documentation/en/SEP_Users_Guide.pdf by default.

         Once the performance data is collected successfully, you will find a .tb6 file in your current folder. Copy this file back to your host system. We will use Intel Vtune Amplifier GUI to view the performance data on host system.

View the Performance Data on Host System

        On your host system, open the vtune amplifier GUI. Create a new project, in the project properties, set the search directories for source files, binary files etc which you used to build your application.
        

        Click the File->Import Result to import the tb6 file. Select the .tb6 file you collected on your target device.
        

        You now get the initial summary report in Vtune Amplifier GUI.
        

        Click Top-down Tree, you will find the hotspot of your application:
        

        Double click the function to locate into the source file and assembly code:    
        

Please refer to the Vtune Amplifier documents which installed on your host for more details, for example the document in following folder with default installation: /opt/intel/system_studio_x.y.z/vtune_amplifier_for_systems/documentation/

 

 

Pour de plus amples informations sur les optimisations de compilation, consultez notre Avertissement concernant les optimisations.