Install Intel® SoC Watch on Yocto Linux

Published: 02/13/2017  

Last Updated: 02/13/2017

By Joel Lin

To get better understanding about this article, you should know first how to build/install SoC Watch collector on Linux and how to build a customized Linux via Yocto on a Intel hardware. In this article, we will introduce how to install Intel Energy Profiler on Yocto Linux. I use Yocto Linux to describe a Linux distribution customized by Yocto. And Yocto is an open source project provides the tools, environment helps you to customize your own Linux distribution. 

Intel Energy Profiler combined Intel® VTune™ Amplifer and SoC Watch two tools, UI Analyzer and command-line data collector. To make sure SoC Watch, this command-line data collector work appropriately, we need to deploy few kernel modules to collect hardware's power metrics. Inside SoCWatch software package, it provides a Linux build script for these kernel modules. For Yocto Linux, we will discuss about the options when and where you can run this build script to prepare the kernel modules. There are three options in general.

Here are the items you need to know before starting next section.

  • You need to visit this link and follow the steps to know how to build out the Yocto Linux image and its SDK. The test hardware is Minnowboard Max. 
  • You need to visit http://intel.ly/system-studio and download the Intel System Studio 2017 Ultimate Edition. Intel SoC Watch tool is included in this edition.
  • Once you installed Intel System Studio Ultimate Edition, you can find Linux SoC Watch package under the location C:\Program Files (x86)\IntelSWTools\VTune Amplifier 2017 for Systems\target. There is a user guide ( SoCWatchUserGuide.pdf ) inside SoC Watch package. Read the section 3.2 of “Build the Kernel Modules” to know how to use build_drivers.sh in Linux.
  • The Yocto Integration layer of ISS is located at C:\Program Files (x86)\IntelSWTools\system_studio_2017.x.x\wr-iss-2017

Three options to build SoCWatch’s kernel driver on Yocto.

Please make sure you go through all the items above. By following one of three options below, you can build out SoC Watch’s kernel driver modules.

Option 1. During the preparation phase of Yocto image building process, you can modify Yocto configurations files (…/poky-xxx-x.x.x/build/conf/bblayers.conf and local.conf) to include Yocto Integration layer of ISS and further add Yocto recipe of SoC Watch. The detail will be documented in README of Yocto Integration layer of ISS. Here we also provide one attached recipe patch file for you to include SoC Watch package in any specified location.

Plain text icon intel-iss-socwatch-target_2017.patch_.txt

Option 2. You can build the kernel modules on the target system which the Yocto image is installed/flashed at. However, you need to include the build tools, header files into the target’s Yocto image. You can add the following required tools through modifying /poky-xxx-x.x.x/build/conf/local.conf during Yocto image built process. After that, you can copy SoCWatch package into the target via SDCARD or network, then run the build_drivers.sh script we mentioned before.

// …/poky-xxx-x.x.x/build/conf/local.conf

IMAGE_INSTALL_append = " autoconf automake binutils binutils-symlinks cpp cpp-symlinks gcc gcc-symlinks g++ g++-symlinks gettext make libstdc++ libstdc++-dev file coreutils kernel-dev kernel-devsrc"

However, this might not be the best way since the efficiency of building speed will depend on the target’s computing power which is usually not that well in the embedded segment device.

Option 3. If you can successfully build out the SDK for your own customized Yocto Linux, you can use SDK to build out the kernel modules. First you need to install SDK on your host machine. After Yocto image built process finished, SDK installation script (.sh) will be generated. SDK environment will be installed on /opt/poky/{version|/ by default. In general, you will have "sysroots" folder which will be exactly as same as the root folders structure in the target device. By using SoCWatch's build_drivers.sh –k to specify the kernel header files you need, you can build out the socwatch kernel modules. However, the recommended way is to use the Linux utility “chroot” to emulate the target's root folder environment on your Linux development host.

Run SoCWatch on Yocto linux and import it into the VTune.

After you successfully built out the socwatch kernel modules which are socwatchx_x.ko and socperfx_x.ko, you can use insmod command to install these kernel modules.

Now you will be able to run socwatch to collect power metrics. Try to run “socwatch –f cpu-cstate –f cpu-pstate –f gfx-cstate –f gfx-pstate –r vtune –o outputfilename” to test collecting data. You can review summary in outputfilename.csv with plain-text format and also can important outputfilename.pwr into VTune to check the visualization of these power metrics. 

vtune_import_socwatch_report

Reference

Preparing a Target Linux* System for Energy Analysis

Configuring Yocto Project* and Intel® VTune™ Amplifier with the Intel System Studio Integration Layer

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.