Achieving Optimal Performance from C/C++ Source Code
Using the Statistical Profiler
Tuning an application begins with an understanding of which areas of the
application are most frequently executed and therefore where improve-
ments would provide the largest gains. The statistical profiling feature
provided in VisualDSP++ is an excellent means for finding these areas.
More details about how to use it may be found in the VisualDSP++ 3.5
User's Guide.
The particular advantage of statistical profiling is that it is completely
unobtrusive. Other forms of profiling insert instrumentation into the
code, perturbing the original optimization, code size and register alloca-
tion to some degree.
The best methodology is usually to compile with both optimization and
debug information generation enabled. In this way, you can obtain a pro-
file of the optimized code while retaining function names and line number
information. This will give you accurate results that correspond directly to
the C/C++ source. Note that the compiler optimizer may have moved
code between lines.
You can obtain a more accurate view of your application if you build it
optimized but without debug information generation. You will then
obtain statistics that relate directly to the assembly code. The only prob-
lem with doing this may be in relating assembly lines to the original
source. Do not strip out function names when linking, since keeping func-
tion names means you can scroll through the assembly window to
instructions of interest.
In very complicated code, you can locate the exact source lines by count-
ing the loops, unless they are unrolled. Looking at the line numbers in the
assembly file (use the
piler generated assembly files, which will have the
may also help. The compiler optimizer may have moved code around so
that it does not appear in the same order as in your original source.
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
switch
-save-temps
(on page
1-44) to retain com-
filename extension)
.s
2-5
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers