Specifications
Adding Explicit STS Instrumentation
Debugging Program Behavior
5-17
5.7 Adding Explicit STS Instrumentation
In the previous section, you used the Statistics View to see the number of
instructions performed during a software interrupt’s execution. If you use a
configuration file, DSP/BIOS supports such statistics automatically. This is
called implicit instrumentation. You can also use API calls to gather other
statistics. This is called explicit instrumentation.
1) In the Project View, double-click on the volume.cdb file (in the DSP/BIOS
Config folder) to open it.
2) Right-click on the STS manager and choose Insert STS from the pop-up
menu.
3) Rename the new STS0 object to processingLoad_STS. The default
properties for this object are all correct.
4) Choose File
→
Close. You are asked whether you want to save your
changes to volume.cdb. Click Yes.
5) In the Project View, double-click on the volume.c program to open it for
editing. Make the following changes to the program:
■
Add the following lines below the line that includes the swi.h file:
#include <clk.h>
#include <sts.h>
#include <trc.h>
■
Add the following to the declarations in the section labeled with the
comment “
Objects created by the Configuration Tool
”:
extern far STS_Obj processingLoad_STS;
■
Add the following lines within the processing function before the call
to the load function:
/* enable instrumentation only if TRC_USER0 is set */
if (TRC_query(TRC_USER0) == 0) {
STS_set(&processingLoad_STS, CLK_gethtime());
}
■
Add the following lines within the processing function after the call to
the load function:
if (TRC_query(TRC_USER0) == 0) {
STS_delta(&processingLoad_STS, CLK_gethtime());
}
6) Choose File
→
Save to save your changes to volume.c.
7) Choose Project
→
Build or click the (Incremental Build) toolbar button.