Chapter 2. Data Collection Using RealView Trace 2

2.1 Hardware profiling overview
2.1.1 Required items
2.2 Hardware installation
2.3 Configuring your hardware target
2.4 Setting hardware preferences within Eclipse
2.4.1 Setting the run control
2.4.2 Setting the sampling rate
2.4.3 Choosing hardware using the connection selector
2.4.4 Choosing the connection type
2.4.5 Setting the ARM executable and enabling semihosting
2.4.6 Setting the working directory
2.4.7 Enabling profiling and naming the new analysis file
2.4.8 Setting an execution time limit
2.4.9 Adding extra commands
2.4.10 Using the export script button
2.5 Executing the run configuration
2.6 Hardware profiling restrictions
2.7 Hardware profiling execution speed

This chapter contains a thorough description of profiling using RealView Trace 2. It includes a general overview of the process and the equipment needed, a hardware installation walk through, and a section on setting up hardware run configuration options using the run configuration dialog within Eclipse. It also includes sections on hardware profiling restrictions and execution speed.

2.1 Hardware profiling overview

This chapter is your guide for setting up your target hardware for profiling using RealView ICE and RealView Trace 2. It will walk you through the basic installation of the hardware, and then guide you through the process of creating a run configuration within the RealView Profiler Eclipse plug-in so that the RealView Trace 2 unit collects the data you are looking for.

From within this RealView Profiler-specific run configuration panel, you can set up which run configuration to use, which connected device to collect data from, and the executable file to load onto the target hardware. This chapter will guide you through the effects of each available field and drop-down menu.

The chapter finishes with a discussion of hardware restrictions and profiling speed.

2.1.1 Required items

In order to get up and running with hardware profiling, you will need the following:

2.2 Hardware installation

In order to get RealView ICE and RealView Trace 2 ready to capture profiling data, follow these steps:

Once you have finished each of these steps, you are ready to launch RealView Profiler and create a new run configuration within Eclipse.

2.3 Configuring your hardware target

As a prerequisite to enable hardware profiling with RealView Profiler, you must configure your hardware target's memory for the application to be profiled. This can be accomplished with a debugger's configuration tool or via your target’s boot monitor.

2.4 Setting hardware preferences within Eclipse

Once you have successfully installed the RealView ICE and RealView Trace 2 hardware and you have created an axf file using ARMCC, you are ready to set the parameters of your hardware profiling run. Open the RealView Profiler-enabled Eclipse by selecting Start > All Programs > ARM > RealView Profiler 1.0 > Eclipse 3.2 IDE. Once open, select Run > Run... from the menu to open Eclipse's run configuration and management window, then click on the ARM RealView Trace 2 in the explorer on the left and then either use the new launch configuration button that appears at the far left of the explorer's toolbar or right-click on ARM RealView Trace 2 and choose the 'New' option from the resulting contextual menu.

This will create a new hardware run configuration and update the panel to look like the one pictured in Figure 2.1:

Figure 2.1. A New RealView Trace 2 Run Configuration

2.4.1 Setting the run control

In order to use the RealView ICE and RealView Trace 2 for profiling, you will need to do one of the following:

2.4.2 Setting the sampling rate

You can enter any integer value between 16 and 1024 into the field directly or use the sampling rate drop-down menu to set the sampling rate for the profiling run to any of the following preset values:

What this does is let the RealView Trace 2 data capture unit know how often to report what instruction is currently being executed. The default value, 1021, tells the RVT2 unit to report the instruction at every 1021 cycle boundary. Setting the rate higher ensures that you do not overload the trace with too much data, while the lowest values generate the highest possible accuracy.

Note

The default sampling rate is set to 1021 because tracking which instruction is being executed every 1021 cycles provides insight into what your code is spending the most time doing without risk of overloading the trace.

2.4.3 Choosing hardware using the connection selector

If there is more than one device on the JTAG scan chain, the connection selector drop-down will enable you to select any of these devices. Each available device is listed next to a sequential number.

2.4.4 Choosing the connection type

The RealView Trace 2 run configuration enables you to choose between the two following connection types:

Use the 'Connection Type' drop-down menu to toggle between these two options.

Note

Your target application should never configure the ETM, as it will interfere with RealView Profiler's configuration of the ETM.

2.4.5 Setting the ARM executable and enabling semihosting

The next step in setting up the hardware profiling run configuration is choosing an image file to run on the target. Enter the directory location of the ARM executable file into the 'Executable' field or use the 'Browse...' button to manually search your directories for the target file.

Note

RealView Profiler will analyze your code regardless of the level of optimization you use when you compile. At the highest level of optimization, however, the in-lining of functions might cause your source code to be hard to decipher in the analysis reports.

There are a few other limitations to keep in mind when selecting an image file to profile:

The RealView Trace 2 launch configuration dialog also allows you to set up semihosting. To disable semihosting, uncheck the semihosting checkbox. If semihosting is enabled, enter any command line arguments for the ARM executable in the provided field.

2.4.6 Setting the working directory

By default, the working directory is set to the current directory, so that any newly created analysis files will be placed in the currently active project. You can specify any directory you wish by entering a new location in the 'Working Directory' field or hitting the 'Browse...' button and navigating to the desired directory location.

2.4.7 Enabling profiling and naming the new analysis file

In order to activate profiling, you will need to make sure the box next to 'Analysis File' is checked. Otherwise, the executable will be run on the target hardware, but no analysis file will be created during the execution.

Figure 2.2. Enabling Profiling

By default, RealView Profiler uses the @F_@N.rpa naming scheme, where @F is the name of the image file and @N is a unique number, between 001 and 999 given to analysis files in sequential order. For example, if example_001.rpa already exists, the next analysis file generated using example.axf will be called example_002.rpa. You can give newly generated analysis files any title you want by entering it into the 'Analysis File' field.

2.4.8 Setting an execution time limit

By default, the 'Time Limit' field is disabled and any profiling run will execute until it is finished or is terminated manually. If you would like to set up a finite test run, you can activate the 'Time Limit' parameter and enter a maximum time value.

To activate the field, click the check box next to the 'Time Limit' field and then enter the maximum number of seconds you would like the execution to last into the newly activated field.

2.4.9 Adding extra commands

To pass any additional commands to the launcher, enter them in the 'Extra Commands' field in the run configuration dialog. Enter the options exactly as you would on the command line, with the appropriate dashes and spacing. The '-h' option works here just as it would on the command line, so if you enter it here and hit the 'Run' button, a list of available command line options will appear in your console.

2.4.10 Using the export script button

The 'Export Script' button within the run configuration window can be used to export the current configuration to an ApplicationName.bat (or .sh shell script, if you are using Linux) file with all of the options you have specified in command line format. In this way, you can use the commands in the ApplicationName.bat (.sh) file to add to your own existing build script or use the generated file as a standalone script.

2.5 Executing the run configuration

Once all of the parameters have been entered into the hardware run configuration dialog, you are ready to execute the image file on the target hardware to create a new analysis file. Make sure your target hardware is connected and powered on, then hit the 'Run' button. A status window will appear that shows you the progress of the execution. The execution will continue until one of the following conditions is met:

2.6 Hardware profiling restrictions

When preparing your source code for profiling using RealView Profiler in conjunction with RealView ICE and RealView Trace 2, it is important to keep the following points in mind:

2.7 Hardware profiling execution speed

A run on your target hardware with profiling enabled will take longer than a standard run on target hardware, due to startup time and report generation. Enabling hardware profiling will not impact the behavior or time of the actual execution of the application.

Copyright © 2007 ARM Limited. All rights reserved. ARM DUI 0412A