TSK_deltatime
2-488
C Interface
Syntax
TSK_deltatime(task);
Parameters
TSK_Handle task;
/* task object handle */
Return Value
Void
Description
This function accumulates the time difference from when a task is made
ready to the time TSK_deltatime is called. These time differences are
accumulated in the task’s internal STS object and can be used to
determine whether or not a task misses real-time deadlines.
If TSK_deltatime is not called by a task, its STS object is never updated
in the Statistics View, even if TSK accumulators are enabled in the RTA
Control Panel.
TSK statistics are handled differently than other statistics because TSK
functions typically run an infinite loop that blocks when waiting for other
threads. In contrast, HWI and SWI functions run to completion without
blocking. Because of this difference, DSP/BIOS allows programs to
identify the “beginning” of a TSK function’s processing loop by calling
TSK_settime and the “end” of the loop by calling TSK_deltatime.
For example, if a task waits for data and then processes the data, you
want to ensure that the time from when the data is made available until
the processing is complete is always less than a certain value. A loop
within the task can look something like the following:
Void task
{
'do some startup work'
/* Initialize time in task's
STS object to current
time */
TSK_settime(TSK_self());
for (;;) {
/* Get data */
SIO_get(...);
'process data'
TSK_deltatime
Update task statistics with time difference