CLK_gethtime
Application Program Interface
2-51
C Interface
Syntax
currtime = CLK_gethtime();
Parameters
Void
Return Value
LgUns
currtime
/* high-resolution time */
Reentrant
no
Description
CLK_gethtime returns the number of high-resolution clock cycles that
have occurred as a 32-bit value. When the number of cycles reaches the
maximum value that can be stored in 32 bits, the value wraps back to 0.
See “High-Resolution Time” on page 2-42 for information about how this
rate is set.
CLK_gethtime provides a value with greater accuracy than
CLK_getltime, but which wraps back to 0 more frequently. For example,
if the timer tick rate is 200 MHz, then regardless of the period register
value, the CLK_gethtime value wraps back to 0 approximately every 86
seconds.
CLK_gethtime can be used in conjunction with STS_set and STS_delta
to benchmark code. CLK_gethtime can also be used to add a time stamp
to event logs.
Constraints and
Calling Context
❏
CLK_gethtime cannot be called from the program’s main() function.
Example
/* ======== showTime ======== */
Void showTicks
{
LOG_printf(&trace, "time = %d", CLK_gethtime());
}
See Also
CLK_getltime
PRD_getticks
STS_delta
CLK_gethtime
Get high-resolution time