Chapter 3. Data Collection Using a Real Time System Model

3.1 Overview
3.2 Using ARM's compilation tools in Eclipse
3.3 Creating a profiling-enabled RTSM run configuration
3.3.1 Choosing an ARM RTSM to run the executable
3.3.2 Choosing an executable and enabling semihosting
3.3.3 Setting the working directory
3.3.4 Enabling profiling and naming the analysis file
3.3.5 Setting the execution time limit
3.3.6 Adding extra commands
3.3.7 Running the configuration
3.4 Enabling profiling outside of Eclipse
3.4.1 Using the export script command

This chapter describes the process of generating analysis reports using a Real Time System Model (RTSM). It includes sections on how to enable profiling in the Eclipse 'Run...' dialog, how to modify your standard build process in both Windows and Linux to enable RealView Profiler, and how to enable profiling from the command line.

3.1 Overview

To perform a comprehensive analysis of your algorithm's behavior in a modeled hardware environment, RealView Profiler must observe it in action. You can use the RealView Compiler to build your image file, as normal, and one of the following to execute your image file:

After profiling has been enabled using the run configuration window in Eclipse, your source code will produce an analysis file filled with important statistical data which will help to shed light on any critical inefficiency.

3.2 Using ARM's compilation tools in Eclipse

If you are using RealView Profiler, you are likely already familiar with ARM's compiler and linker and how to set compilation options within Eclipse. Both the RealView Compilation Tools and RealView Profiler are used within Eclipse, so as to streamline your build process and make the Eclipse interface your one-stop Development Environment for the writing, building and profiling of your code with the RealView Development Suite (RVDS).

If you need help with generating an image file using the RealView Compilation Tools, refer to the following documentation:

3.3 Creating a profiling-enabled RTSM run configuration

Once you have built an image file using the ARM compiler, you are ready to start profiling your code. The quickest way to do a profiling-enabled run is to right-click on an image file and choose a pre-configured run command from one of the available ARM processors, as shown in Figure 3.1:

Figure 3.1. Choosing a Pre-configured Run Configuration

If you want to define your own build configuration within Eclipse, you will need to create a new run configuration. Select Run > Run... from the menu to open Eclipse's run configuration and management window. Click on the ARM Real Time System Model in the explorer on the left and then either press the new launch configuration button that appears at the far left of the explorer's toolbar or right-click on ARM Real Time System Model configuration and choose the 'New' option from the resulting contextual menu.

Once you have successfully created an ARM RTSM run configuration, your Eclipse run window should look like the one pictured in Figure 3.2:

Figure 3.2. A New ARM RTSM Run Configuration

3.3.1 Choosing an ARM RTSM to run the executable

From the 'Model' drop-down menu, you can choose any of the predefined ARM models to run on, or select the custom option and use your own.

There are currently three predefined models to choose from:

All have been configured to match their hardware counterparts.

If none of these predefined options match your target architecture, you can use your own customized RTSM to test against. Select 'Custom' from the drop-down menu and enter the directory location of your RTSM file. You can use the 'Browse...' button to explore your directories for the target file.

Note

RealView Profiler works with RTSMs created using RealView System Generator versions 3.1 and above.

Note

Although it is possible to build a multi-core RTSM using System Generator, RealView Profiler does not support them at this time.

3.3.2 Choosing an executable and enabling semihosting

The next step in preparing the run configuration for profiling is choosing an image file to run. Enter the directory location of the ARM executable file in the RTSM run configuration window's 'Executable' field located just underneath the model file field. You can use the 'Browse...' button to manually search your directories for the target file.

The 'Semi-Hosting' checkbox enables you to turn on semihosting, a mechanism that captures I/O requests made by code running on the target system and communicates these to the host system for handling. The adjacent field enables you to pass command line arguments to the specified ARM executable. Enter them here exactly as you would on the command line.

3.3.3 Setting the working directory

By default, the working directory is set to the current directory. To change this behavior, and have model_shell execute in a different location, enter a directory location in the 'Working Directory' field or find it on disk by clicking the 'Browse...' button.

Note

The model_shell command is a tool that is provided by RealView System Generator for the running of hardware models.

If profiling is turned on, the new analysis file will be created in the working directory when the run has terminated.

3.3.4 Enabling profiling and naming the analysis file

To enable profiling, you must have the 'Analysis File' option checked. If this box is left unchecked, profiling will be disabled and no analysis file will be created at the end of the execution.

Figure 3.3. An Important Profiling Step

If profiling is enabled, you can use the attached field to name the resulting analysis file. By default, RealView Profiler uses @F_@N.rpa, where @F is the name of the image file and @N is a variable used to add a unique number, between 001 and 999 to the end of the file name. Thus the second file generated using example.axf would be called example_002.rpa, by default. You can use your own custom title by replacing the name in the 'Analysis File' field with your own.

3.3.5 Setting the execution time limit

By default, the time limit field is inactive and a run will continue until it finishes or you terminate it. To add a limit to the execution time so that a run will stop automatically at a defined length, click the checkbox next to the 'Time Limit' and enter a value, in seconds, into the field.

3.3.6 Adding extra commands

Use the 'Extra Commands' field in the run configuration dialog to pass options through to model_shell. Enter the -h option here and hit the 'Run' button and a list of all the options available for use with model_shell will appear in Eclipse's console. For example, to enable floating point registers enter the following command in the 'Extra Commands' field:

--parameter $COREINST.vfp-enable_at_reset=1

The variable $COREINST is used by RealView Profiler as the core instance, while the vfp-enable_at_reset=1 command is used to activate floating point registers.

3.3.7 Running the configuration

Once all of the parameters have been defined, click the 'Run' button located in the bottom right corner of the configuration panel to execute the configuration. When the execution is finished, the newly-generated analysis file will automatically open in the editor section of Eclipse.

Note

3.4 Enabling profiling outside of Eclipse

If you want to run your source code with profiling enabled outside of the Eclipse Integrated Development Environment (IDE), you will need to modify your standard build process, either by adding to a shell script (Linux) or run.bat (Windows) file.

3.4.1 Using the export script command

To help you in the setting up of batch files or shell scripts used to enable profiling and execute your code, RealView Profiler provides the 'Export Script' in the RTSM run configuration window within Eclipse. Use the 'Run..' menu to point to the right model and use the name field to name your generated analysis files and hit the 'Export Script' button.

If you are running RealView Profiler on Windows, this command will produce an ApplicationName.bat file with all the appropriate commands to do a profiled run. In the DOOM example, the generated output would look like this:

@echo off

REM Automatically generated on 11/12/07 2:34 PM
REM For more options, type: "%RVP_ROOT%\tools\rtsm\win32\model_shell.exe" --help
pushd C:\workspace\doom
"%RVP_ROOT%\tools\rtsm\win32\model_shell.exe" -m "%RVP_ROOT%\tools\rtsm\win32\RTSMEmulationBaseboard_CT1136-rel.dll" -a
EB1136CoreTile.arm1136ct=doom.axf --timelimit 2147483 -C EB1136CoreTile.arm1136ct.profiler-enable=1 -C
EB1136CoreTile.arm1136ct.profiler-output_file=@F_@N.rpa
popd

This command executing in Linux will produce a shell script instead of a batch file:

#!/bin/sh

# Automatically generated on 11/12/07 10:31 AM
# For more options, type: ${RVP_ROOT}/tools/rtsm/linux/model_shell --help

cd tools/ARM/RVP/Contents/1.0/0/examples/doom
LD_LIBRARY_PATH=${RVP_ROOT}/tools/rtsm/linux ${RVP_ROOT}/tools/rtsm/linux/model_shell -m
${RVP_ROOT}/tools/rtsm/linux/RTSMEmulationBaseboard_CTCortexA8-rel.so -a
EBCortexA8CoreTile.armCortexA8ct=doom.axf --timelimit 2147483 -C
EBCortexA8CoreTile.armCortexA8ct.profiler-enable=1 -C
EBCortexA8CoreTile.armCortexA8ct.profiler-output_file=@F_@N.rpa

You can use any or all of the commands created by the export script in your own build system, to make profiling your code a seamless part of the process.

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