API Reference Manual
1.46.0
|
SoC global and CPU local wall clock time.
Data Structures | |
struct | odp_time_t |
struct | odp_time_startup_t |
Time stamp values at ODP startup. More... | |
Macros | |
#define | ODP_TIME_NULL ((odp_time_t){.u64 = 0}) |
Zero time stamp. | |
#define | ODP_TIME_USEC_IN_NS 1000ULL |
A microsecond in nanoseconds. | |
#define | ODP_TIME_MSEC_IN_NS 1000000ULL |
A millisecond in nanoseconds. | |
#define | ODP_TIME_SEC_IN_NS 1000000000ULL |
A second in nanoseconds. | |
#define | ODP_TIME_MIN_IN_NS 60000000000ULL |
A minute in nanoseconds. | |
#define | ODP_TIME_HOUR_IN_NS 3600000000000ULL |
An hour in nanoseconds. | |
Typedefs | |
typedef struct odp_time_t | odp_time_t |
ODP time stamp. More... | |
typedef struct odp_time_startup_t | odp_time_startup_t |
Time stamp values at ODP startup. | |
Functions | |
odp_time_t | odp_time_local (void) |
Current local time. More... | |
uint64_t | odp_time_local_ns (void) |
Current local time in nanoseconds. More... | |
odp_time_t | odp_time_local_strict (void) |
Current local time (strict) More... | |
uint64_t | odp_time_local_strict_ns (void) |
Current local time in nanoseconds (strict) More... | |
odp_time_t | odp_time_global (void) |
Current global time. More... | |
uint64_t | odp_time_global_ns (void) |
Current global time in nanoseconds. More... | |
odp_time_t | odp_time_global_strict (void) |
Current global time (strict) More... | |
uint64_t | odp_time_global_strict_ns (void) |
Current global time in nanoseconds (strict) More... | |
odp_time_t | odp_time_diff (odp_time_t t2, odp_time_t t1) |
Time difference. More... | |
uint64_t | odp_time_diff_ns (odp_time_t t2, odp_time_t t1) |
Time difference in nanoseconds. More... | |
odp_time_t | odp_time_add_ns (odp_time_t time, uint64_t ns) |
Add nanoseconds into time. More... | |
odp_time_t | odp_time_sum (odp_time_t t1, odp_time_t t2) |
Time sum. More... | |
uint64_t | odp_time_to_ns (odp_time_t time) |
Convert time to nanoseconds. More... | |
odp_time_t | odp_time_local_from_ns (uint64_t ns) |
Convert nanoseconds to local time. More... | |
odp_time_t | odp_time_global_from_ns (uint64_t ns) |
Convert nanoseconds to global time. More... | |
int | odp_time_cmp (odp_time_t t2, odp_time_t t1) |
Compare two times. More... | |
uint64_t | odp_time_local_res (void) |
Local time resolution in hertz. More... | |
uint64_t | odp_time_global_res (void) |
Global time resolution in hertz. More... | |
void | odp_time_wait_until (odp_time_t time) |
Wait until the specified (wall clock) time has been reached. More... | |
void | odp_time_wait_ns (uint64_t ns) |
Wait the specified number of nanoseconds. More... | |
void | odp_time_startup (odp_time_startup_t *startup) |
Get ODP instance startup time. More... | |
ODP time stamp.
Time structure used for both POSIX timespec and HW counter implementations.
Time stamp can represent a time stamp from local or global time source. A local time stamp must not be shared between threads. API calls work correctly only when all time stamps for input are from the same time source.
odp_time_t odp_time_local | ( | void | ) |
Current local time.
Returns current CPU local time stamp value. The used time source is specific to the calling thread and the CPU it is running on during the call. Time stamp values from different time sources cannot be compared or otherwise mixed.
Local time stamp value advances with a constant rate defined by odp_time_local_res(). The rate remains constant even during dynamic CPU frequency scaling. Local time stamp and related nanosecond values may not start from zero, but are guaranteed not to wrap around in at least 10 years from the ODP instance startup.
uint64_t odp_time_local_ns | ( | void | ) |
Current local time in nanoseconds.
Like odp_time_local(), but the time stamp value is converted into nanoseconds.
odp_time_t odp_time_local_strict | ( | void | ) |
Current local time (strict)
Like odp_time_local(), but reads the time stamp value more strictly in the program order. The function may decrease CPU performance around the call, as it may include additional barrier instructions or otherwise limit out-of-order execution.
uint64_t odp_time_local_strict_ns | ( | void | ) |
Current local time in nanoseconds (strict)
Like odp_time_local_strict(), but the time stamp value is converted into nanoseconds.
odp_time_t odp_time_global | ( | void | ) |
Current global time.
Returns current SoC global time stamp value. Global time stamp values read by different threads (or CPUs) may be compared or otherwise mixed as those come from the same time source.
Global time stamp value advances with a constant rate defined by odp_time_global_res(). The rate remains constant even during dynamic CPU frequency scaling. Global time stamp and related nanosecond values may not start from zero, but are guaranteed not to wrap around in at least 10 years from the ODP instance startup.
uint64_t odp_time_global_ns | ( | void | ) |
Current global time in nanoseconds.
Like odp_time_global(), but the time stamp value is converted into nanoseconds.
odp_time_t odp_time_global_strict | ( | void | ) |
Current global time (strict)
Like odp_time_global(), but reads the time stamp value more strictly (see odp_time_local_strict() documentation) in the program order.
uint64_t odp_time_global_strict_ns | ( | void | ) |
Current global time in nanoseconds (strict)
Like odp_time_global_strict(), but the time stamp value is converted into nanoseconds.
odp_time_t odp_time_diff | ( | odp_time_t | t2, |
odp_time_t | t1 | ||
) |
Time difference.
t2 | Second time stamp |
t1 | First time stamp |
uint64_t odp_time_diff_ns | ( | odp_time_t | t2, |
odp_time_t | t1 | ||
) |
Time difference in nanoseconds.
t2 | Second time stamp |
t1 | First time stamp |
odp_time_t odp_time_add_ns | ( | odp_time_t | time, |
uint64_t | ns | ||
) |
Add nanoseconds into time.
Adds 'ns' nanoseconds into the time stamp value. The resulting time may wrap around, if the sum of 'time' and 'ns' is more than 10 years from the ODP instance startup.
time | Time stamp |
ns | Nanoseconds to be added |
odp_time_t odp_time_sum | ( | odp_time_t | t1, |
odp_time_t | t2 | ||
) |
Time sum.
Returns the sum of time stamp values. Time stamps must be from the same time source (global or local). The resulting time may wrap around, if the sum exceeds 10 years from the ODP instance startup.
t1 | Time stamp |
t2 | Time stamp |
uint64_t odp_time_to_ns | ( | odp_time_t | time | ) |
Convert time to nanoseconds.
time | Time |
odp_time_t odp_time_local_from_ns | ( | uint64_t | ns | ) |
Convert nanoseconds to local time.
ns | Time in nanoseconds |
odp_time_t odp_time_global_from_ns | ( | uint64_t | ns | ) |
Convert nanoseconds to global time.
ns | Time in nanoseconds |
int odp_time_cmp | ( | odp_time_t | t2, |
odp_time_t | t1 | ||
) |
Compare two times.
t2 | Second time |
t1 | First time |
<0 | when t2 < t1 |
0 | when t2 == t1 |
>0 | when t2 > t1 |
uint64_t odp_time_local_res | ( | void | ) |
Local time resolution in hertz.
uint64_t odp_time_global_res | ( | void | ) |
void odp_time_wait_until | ( | odp_time_t | time | ) |
Wait until the specified (wall clock) time has been reached.
The thread potentially busy loop the entire wait time.
time | Time to reach before continue |
void odp_time_wait_ns | ( | uint64_t | ns | ) |
Wait the specified number of nanoseconds.
The thread potentially busy loop the entire wait time.
ns | Time in nanoseconds to wait |
void odp_time_startup | ( | odp_time_startup_t * | startup | ) |
Get ODP instance startup time.
Outputs time stamp values captured at ODP instance startup. Application may use those to calculate time stamp values relative to ODP startup time.
[out] | startup | Startup time structure for output |