Profile overview


In SDK, you can profile the program running on embedded hardware. The Profiling feature is software-intrusive, and is based on the GNU gprof tool. GNU gprof provides two kinds of information that you can use to optimize the program:

For additional information about GNU gprof, refer to http://sourceware.org/binutils/docs-2.18/gprof/index.html.

How profiling works

The execution flow of the program is altered so that gprof can obtain data. Consequently, this method of profiling is considered “software-intrusive”. The program flow is altered in two ways:

The profiling workflow is described in the following diagram:

SDK Profile Workflow

Setting up the hardware for profiling

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 to the processor either directly or through an interrupt controller.

Setting up the software for profiling

There are three important steps involved in setting up the software application for profiling:

  1. You must enable profiling in the Software Platform to include profiling libraries. Profiling is supported only for standalone software platforms.
  2. You must modify the software application code to enable interrupts. If the profile timer is directly connected to the processor without an interrupt controller, you must enable interrupts in the processor. If there is an interrupt controller present in the system, then in addition to enabling interrupts in the processor, the interrupt controller should also be enabled and allowed to pass interrupts from the profile timer to the processor.
  3. In order to profile your application, you must use an executable compiled for profiling (such as the -pg compiler switch). You should use the profile build configuration to build your application. Refer to Build configurations for more information.

Generating and viewing profile data

  1. In order to profile the application, you must create a run configuration in SDK and provide options in the Profiler tab. Refer to Run configuration and Profile configuration for more information.
  2. When profiling the program on a hardware target, SDK uses Xilinx Microprocessor Debugger (XMD) for communication to the processor using a JTAG interface on the board. The JTAG settings for the profile session can be specified in the JTAG Settings dialog box. In most cases, SDK can automatically detect the JTAG settings and does not require special settings. Refer to JTAG settings for more information.
  3. The XMD Run Console allows you to stop the program execution. When the program completes execution, the Profiler automatically stops the program, then reads the profile data and processes it. You can also choose to stop program execution at any time.
  4. The Xilinx Profiler perspective presents a collection of views to visualize the statistics for the profiled program. SDK automatically launches the Xilinx Profiler perspective after the program execution completes or stops. Refer to Xilinx Profiler perspective for more information.

Supported profile targets

SDK supports profiling the application on all processor architecture targets running on a hardware board. As mentioned here, the hardware system should have a timer interrupt for generating periodic sampling interrupts.

Related concepts
Build configurations
Debug configurations
JTAG settings
Profile configuration
Xilinx Profiler perspective

Related tasks
Profiling

Copyright © 1995-2009 Xilinx, Inc. All rights reserved.