Cycle Counting and Profiling
Cycle Counting and Profiling
Cycle Counting and Profiling
a
Technical notes on using Analog Devices DSPs, processors and development tools
Visit our Web resources http://www.analog.com/ee-notes and http://www.analog.com/processors or
e-mail [email protected] or [email protected] for technical support.
Cycle Counting and Profiling
Contributed by C. Gilchrist Rev 2 March 27, 2008
Copyright 2008, Analog Devices, Inc. All rights reserved. Analog Devices assumes no responsibility for customer product design or the use or application of
customers products or for any infringements of patents or rights of others which may result from Analog Devices assistance. All trademarks and logos are property
of their respective holders. Information furnished by Analog Devices applications and development tools engineers is believed to be accurate and reliable, however
no responsibility is assumed by Analog Devices regarding technical accuracy and topicality of the content provided in Analog Devices Engineer-to-Engineer Notes.
Introduction
VisualDSP++ development environment
provides utilities that can be used to profile an
application's performance. These utilities provide
a means to analyze your application, allowing
you to identify and eliminate performance
bottlenecks and to optimize code. By using
execution profiles, application developers can
hand-tune code memory layout to achieve better
system performance.
The provided tools include:
Linear Profiler, a simulator-only utility
Statistical Profiler, a utility for use with
emulator and EZ-KIT Litetargets
Embedded profiling via cycle count facilities
The Linear and Statistical Profiling tools, which
are non-intrusive, provide a profile of
the instruction execution time, the number of
clock cycles spent executing instructions,
number of instructions executed, and the number
of memory reads and writes an application takes
to execute.
The Linear Profiler samples every PC executed,
which provides a complete and accurate picture
of the performance of the code. The cost of this
accuracy, however, is a slow method of profiling
the application, which would not be feasible on a
hardware target.
The Statistical Profiler is faster, allowing you to
profile without affecting the real-time
characteristics of the application. The Statistical
Profiler achieves this by sampling the PC
periodically. It is not as accurate or consistent as
the Linear Profiler, but provides a means to
profile code execution on a hardware target.
The VisualDSP++libraries also offer the ability
to obtain accurate cycle counts and measure
execution time by embedding code in your
application to calculate and return cycle count
information. This is facilitated by the cycle count
registers and macros provided in the libraries.
This document describes the functional behavior
of these tools, as well as their use, performance
benefits, features, and limitations.
Additionally, this document is accompanied by
example code for Blackfin, SHARC, and
TigerSHARC processors to demonstrate the
differences between profiling results returned
from the simulator and on hardware.
Profiler and Cycle Count User
Guide
The following instructions apply to all
architectures (Blackfin, SHARC, and
TigerSHARC).
Statistical and Linear Profilers
Enabling and Configuring the Profiler
The Linear Profiler, which is available for
simulator sessions only, is enabled via Tool s - >
Li near Pr of i l i ng.
a
Cycle Counting and Profiling (EE-332) Page 2 of 9
The Statistical Profiler, which is available for
emulator/EZ-KIT Lite sessions only, is enabled
via Tool s - > St at i st i cal Pr of i l i ng.
You can configure a number of options within
the profilers to fine-tune the profile information
you require. These options are accessible by
right-clicking the Profiler window and choosing
Pr oper t i es.
The Di spl ay tab (Figure 1) allows you to
specify the memory type, and the associated
metrics you wish to profile. The available
memory types are specific to the target, and
the available metrics are specific to the
memory type. The optional metrics allow you
to include data such as the number of
reads/writes, cache hits/misses, execution
counts, and so on, within your profile data.