Digital Signal Processing Reference
In-Depth Information
for(count=0; count<N; count++)
sum += array[count];
return(sum);
}
•
Go through all the steps required to run the program.
Step 11: Benchmarking
Now we will
benchmark
or time the subroutine to determine how long it
takes to return the sum.
•
Reload
the program.
• Select
Profiler
>
Start New Session
.
• Title the session
Lab 1
. A
profile
window comes up in the bottom.
• Double click on
main.c
in the project window.
• Put your cursor on the line:
int ret_sum(const short* array, int N)
.
• Several shortcut buttons are on the left side of the
Profile window
.
• Hit the
Create Profile Area
button. Make sure the type is
Function
and the line number corresponds to the beginning of the function,
since this is where you placed the cursor.
•H t
OK
.
•
Expand
Lab1.out
under the Files window pane. The function
ret_sum
should be there.
•
Run
the program.
•
The value for the
Incl. Total
in the profiler window is the number
of clock cycles needed to run the function
ret_sum
.
•
To redo this exercise, highlight
ret_sum
in the
Files window pane
,
right click
, and select
Clear Selected
.
•
Then hit
Debug
>
Restart
and
Run
the program.
Optimization can change the amount of time required to run the function.
To observe the effects, follow these instructions:
• Select
Project > Build Options
.
• Choose
Compiler, Basic,
and
Opt Level o0
.
• Select
Project > Rebuild All
.
• Select
File > Load Program Lab1.out
.
• Highlight
ret_sum
in the
Files pane
,
right click
, and select
Clear
Selected
.
•H t
Debug > Run
.
Repeat the above for the other levels of optimization
o1
,
o2
, and
o3
, and
compare the number of clock cycles for each optimization.