Instrumentation APIs
Instrumentation
3-23
3.5.3.1 Statistics About Varying Values
STS objects can be used to accumulate statistical information about a time
series of 32-bit data values.
For example, let P
i
be the pitch detected by an algorithm on the i
th
frame of
audio data. An STS object can store summary information about the time
series {P
i
}. The following code fragment includes the current pitch value in the
series of values tracked by the STS object:
pitch = `do pitch detection`
STS_add(&stsObj, pitch);
The Statistics Data tool displays the number of values in the series, the
maximum value, the total of all values in the series, and the average value.
3.5.3.2 Statistics About Time Periods
In any real-time system, there are important time periods. Since a period is
the difference between successive time values, STS provides explicit support
for these measurements.
For example, let T
i
be the time taken by an algorithm to process the i
th
frame
of data. An STS object can store summary information about the time series
{T
i
}. The following code fragment illustrates the use of CLK_gethtime (high-
resolution time), STS_set, and STS_delta to track statistical information
about the time required to perform an algorithm:
STS_set(&stsObj, CLK_gethtime());
`do algorithm`
STS_delta(&stsObj, CLK_gethtime());
STS_set saves the value of CLK_gethtime as the contents of the previous
value field (set value) in the STS object. STS_delta subtracts this set value
from the new value it is passed. The result is the difference between the time
recorded before the algorithm started and after it was completed; that is, the
time it took to execute the algorithm (T
i
). STS_delta then invokes STS_add
and passes this result as the new contents of the previous value field to be
tracked.
The host can display the count of times the algorithm was performed, the
maximum time to perform the algorithm, the total time performing the
algorithm, and the average time.
The set value is the fourth component of an STS object. It is provided to
support statistical analysis of a data series that consist of value differences,
rather than absolute values.
Summary of Contents for TMS320 Series
Page 1: ...TMS320 DSP BIOS v5 40 User s Guide Literature Number SPRU423G April 2009 ...
Page 16: ...xvi ...
Page 152: ...Tasks 4 48 Figure 4 12 Trace from Example 4 7 ...
Page 168: ...Semaphores 4 64 Figure 4 14 Trace Results from Example 4 11 ...
Page 202: ...5 20 ...
Page 287: ...Index 9 Index Void 1 11 W words data memory 3 15 of code 1 5 wrapper function 2 29 ...
Page 288: ...Index 10 Index ...