Profiling a program
Profiling an application involves multiple steps from setting up the hardware in Xilinx® Platform Studio (XPS), setting up the software platform and application, and running the application. These steps are described in detail below.
Setting up the hardware
To profile a software application, you must ensure that interrupts are raised periodically to sample the program counter (PC) value. To do this, you must program a timer and use the timer interrupt handler to collect and store the PC. The profile interrupt handler requires full access to the timer, so a separate timer that is not used by the application itself must be available in the system.
Xilinx profiling libraries that provide the profile interrupt handler support the xps_timer core. When profiling on PowerPC® processors, the internal Programmable Interrupt Timer (PIT) can also be used. Either one of these timers should be available for exclusive use by the profile libraries.
The timer interrupt signal is connected directly to the processor, or it is connected to the processor through an interrupt controller. Look at the hardware design report, by selecting Hardware Design > View Design Report, to check if the connectivity exists in the system.
Setting up the software platform
- Select the Software Platform of the software application in the C/C++ Projects View, then select Tools > Software Platform Settings.
- In the Processor Settings tab, set the enable_sw_intrusive_profiling field to true and select the timer for use by the profile libraries.
- Click OK.
Setting up the software application
- Modify the software application code to enable interrupts. If there is an interrupt controller present in the system with multiple interrupt sources, you must enable interrupts in the processor and the interrupt controller to allow interrupts from the profile timer to reach the processor. Example code is shown below:
/* enable interrupt controller */
XIntc_mMasterEnable(SYSINTC_BASEADDR);
/* service all interrupts */
XIntc_SetIntrSvcOption(SYSINTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION);
/* enable the profile timer interrupt */
XIntc_mEnableIntr(SYSINTC_BASEADDR, PROFILE_TIMER_INTR_MASK);
/* enable interrupts in the processor */
microblaze_enable_interrupts();
- If the profiling timer is the only entity that connects to the input of interrupt controller or directly to the processor, the tool sets up the interrupt for you automatically, and no change is required in the application code.
- Right-click the software application and select Properties. Change the C/C++ Build > Configuration to Profile.
- Click OK.
Creating a profile run configuration
To profile an application, you must create a configuration that captures the settings for profiling the application. Once the configuration has been created, it can be used to again debug the application.
- In the C/C++ Projects View, select the application to debug.
- Select Run > Run.
- In the Run Configurations dialog box, expand Xilinx C/C++ ELF.
- Click New. The name of the new project is displayed in the Configurations box. The default name is the name of the project.
- Make sure the ELF file generated using profile configuration is selected in the C/C++ Application field.
- In the Profiler tab, do the following:
- Click to select the Enable Profiling check box.
- Make sure that the Show Profile Results Immediately check box is selected.
- Specify the Scratch Memory Address to Collect Profile Data to use for profiling in hex. This is a valid system memory address that is not used by the software application.
- Use the defaults for the Sampling Frequency and Histogram Bin Size values.
- Use the default settings for the other tabs and click Run.
Profiling the application
When the application finishes running, SDK switches to the Xilinx Profiler perspective. If you want to stop program execution, type stop on the XMD Console.
For more information on interpreting the profile data in the profiler perspective, refer to Xilinx Profiler perspective

Profile overview
Profile configuration
Xilinx Profiler perspective

Configuring a software platform
Selecting a project type
Creating or editing a Run/Debug/Profile configuration
Copyright © 1995-2009 Xilinx, Inc. All rights reserved.