Analyzing an example Streamline report with Arm DS

Learn how to import, re-analyze, and then explore the XaoS example report included in Streamline. The report was generated running the XaoS example included in Arm Development Studio (Arm DS).


Introduction Import the Linux example project Import the Streamline example report Re-analyze the report Exploring the example report Add the missing source code Example - How to analyze the Streamline capture Add the project path to Streamline locations

Introduction

We use one of the example reports that are included with Streamline. These reports provide a quick way of exploring the features of the Streamline performance analyzer. The sample report used in this tutorial was captured by running the XaoS example included in Arm Development Studio (Arm DS) on a Cortex-A7 and Cortex-A15 Versatile Express board.

Import the Linux example project

The sample Streamline XaoS report was generated using the XaoS example project in Arm DS. Therefore, to work with the report, you must import the Arm DS XaoS example project to your Arm DS Workspace. To import the XaoS example project:

  1. Open Arm DS IDE.
  2. Click File > Import.
  3. In the Import window, expand Arm Development Studio and select Examples & Programming Libraries. Click Next. Import Example and Programming Libraries selection
  4. In the Import Examples and Programming Libraries window, expand Examples > Linux Applications and select xaos. You can also write "xaos" in the search bar to locate the example project. Click Finish. Import xaos Linux application example
  5. The xaos example project now appears in the Project Explorer view.

What is XaoS?:
XaoS is an open-source "interactive fractal zoomer" application. In our case, it runs multi-threaded to generate an interesting report.

Import the Streamline example report

Streamline is included with Arm DS installation. Now open Streamline. You will see the following IDE:


Importing Streamline Xaos sample capture

Now, you must import the XaoS Streamline example report. To import the example reports:

  1. Click File > Import...
  2. Select Import Streamline Sample Captures and click Next.

    Import Streamline Samples Captures selection

  3. You can now select the sample Streamline captures available that you want to import. For this tutorial, select the Linux > Arm DS Xaos Example. To import the sample capture, click Finish.
    Import Arm DS Xaos Example selection

Re-analyze the report

The Linux - TC2 - Xaos capture is listed in the Streamline Data view. Notice that the vertical bar at the left of the capture (in the list of captures) is yellow, meaning it must be re-analyzed.

Importing Streamline sample capture

Why do I have to re-analyze the report?:
Since the report was generated with a different version of Arm DS, you must re-analyze it in to update it.
In the Analyze dialog box, you can load extra program images. These images can be useful for gaining a more comprehensive idea of system execution, or alternatively, for focusing on one particular program. Streamline loads debug symbols if available.

To open the Analyze dialog, double-click on the Streamline capture. In the Program Images tab, select the ELF images xaos and libpthread-2.17.so. Then click Analyze. Re-analyzing the capture might take some time.
Adding program images to Streamline Analyze dialog

Exploring the example report

The XaoS report opens in a new tab automatically once you have re-analyzed it. It provides a summary view of CPU performance, branch mispredictions, memory and cache accesses, along with a sample of the frame buffer. Note that the vertical bar of the capture is now colored blue in the Streamline Data view, meaning it is up to date.

Streamline Timeline description

In the panel underneath these charts, there is a heatmap for each process and thread. Click individual processes or threads to reconfigure the charts to reflect them. You can also see annotations on each thread and the frame buffer, which are being passed from the source code. These annotations are a very useful profiling tool when you are working on your own code.

Along the top of the report, there are tabs which break down the data all the way to source code level. When using Streamline to profile your own software, look for areas where the CPU is being pushed hard, or where the cache is being heavily used. Then, try to identify which line of code is causing this.

I see numerous <unknown code in "x"> in the Call Paths and Functions tabs:
This issue relates to the images that you use for analysis in the first place. By default, this capture only includes a couple of images (in this case, the images xaos and libpthread-2.17.so). So, while Streamline knows that function "x" is taking up a certain percentage of processor time, it does not know what this code is.

Add the missing source code

In the Functions tab, try double-clicking on a function name such as calculate. This action takes you to the corresponding line of source code. However, the source file is missing.

Missing source code for Streamline capture

Follow the on-screen hint to Click here to locate the file. You can find the source code for the XaoS example project in your workspace. You can locate the file in C:\Users\<User>\Development Studio Workspace\xaos\xaos-3.5\src\engine\calculate.h.

Once you have located the file, the source code appears:

Code located

Example - How to analyze the Streamline capture

In the Timeline view, you can see a timeline with information such as CPU activity, branch mispredictions, and instructions executed. You can click the timeline to set a cross-section market at 1.75 seconds of execution. That point in the execution time corresponds to one of the activity peaks in the Cortex-A7 core.

In the heat map below, you can see the CPU activity for the different processes. At 1.75s, you notice that the xaos #2750 process is in orange color, using 36.37% of the CPU Activity.

Example Streamline Timeline view for analysis

Go to the Call Paths view selecting the Call Paths tab. The main code is contained within the xaos #2750 process and thread. We want to see which functions in main are using more resources. If you click main, you can see that more than half of the samples (52.81%) in main correspond to the function VisualAnnotateImage. That corresponds to a 11.11% of samples in the xaos #2750 process.

Example Streamline Call Paths view for analysis

Now, select the Functions tab to see the Functions view. You can see that the function VisualAnnotateImage appears at the top and that it is one of the functions with the highest number of samples. Double-click the function to open the Code view for the VisualAnnotateImage function.

Example Streamline Functions view for analysis

One of the advantages of Streamline is that you can obtain a performance analysis from a high level and general perspective to the lowest level possible. In this example, we began detecting one of the processes with the highest CPU activity. Then, we detected one of the functions with more samples, within the main code that is executed in that process. Now, we can reach the lowest level possible, which is detecting which instructions are executed more frequently.

In the Code view, you see the code for the VisualAnnotateImage function, which is included in annotate.c. Select the highlighted icon in the following image to also show the assembly code:

Streamline Code view selection for analysis

The code in line 174 (for loop) corresponds to the 49.04% of the samples in the function. If you click the line 174, you can see the associated assembly code in green. You have been able to locate the instructions that are constantly executed in your code. This procedure can help you detecting bottlenecks in your code. The instruction ADD r2,r2,#3 corresponds to the 30.05% of the samples in the VisualAnnotateImage function.

Example Streamline Code view for analysis

Add the project path to Streamline locations

If you generate and save your own Streamline reports in a project, you must include the location of the reports. You must indicate the path to the folders with the captures you want to analyze, so Streamline can find the captures in your file system.

As an example, in case you created and saved reports in your Xaos project:

  1. In Streamline, click Window > Preferences.
  2. To add or remove locations where Streamline analysis data can be found, select Data Locations.
  3. Click New and select the Streamline folder with captures within the xaos project folder in your workspace. Then click Apply and close.
  4. Your captures are now listed in the Streamline Data view.