HP (Hewlett-Packard) EZ-KIT Switch User Manual


 
Example 2: Benchmarking the Relative Performance of
Memories
2-4 Getting Started with ADSP-BF548 EZ-KIT Lite
Example 2: Benchmarking the Relative
Performance of Memories
Now that you are familiar with basic VisualDSP++ operations, it is time to
analyze and tweak a program’s performance. Close the Example_1.dpj file
using the File–>Close–>Project menu selection. Open the next project
file (Example_2.dpj) located in the
<install_path>\Blackfin\Examples\ADSP-BF548 EZ-Kit Lite\Getting
Started Examples\Example_1 subdirectory of your VisualDSP++
directory.
This project builds on the program discussed in the previous exercise. The
same sequence of function calls (randomize_arrays(), bubble_sort(),
and quick_sort()) now is enclosed in a loop that repeats the sequence suf-
ficient number of times in order to profile the loop’s execution. In
addition, some code has been added to the program to obtain and print a
rough measure of the loop’s execution time in seconds, along with the
number of clock cycles the loop required.
Looking at the new version of the C source file (Sorts.c) you see there are
some additional #include directives at the top of the file. These are C dec-
larations for using printf(), for starting and reading the processor’s
real-time clock (RTC), and for reading the cycle counter. The RTC is a
straightforward device; the code in functions
start_real_time_clock()
and get_real_time_clock_in_seconds() shows how the clock’s control
registers and value are accessed from a C program by simple pointer
de-referencing.
The control registers of all Blackfin peripherals are mapped into the stan-
dard address space and can be accessed in a similar manner; although, the
set-up and control required for most of the other peripherals is more com-
plicated than that for the RTC. In Chapter 3, “Using ADSP-BF548
EZ-KIT Lite Peripherals” on page 3-1, we will see that VisualDSP++ sup-
plies libraries of service functions and device drivers to simplify and
standardize the use of many processor peripherals (including the RTC)