diff options
Diffstat (limited to 'include/odp/api/time.h')
-rw-r--r-- | include/odp/api/time.h | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/include/odp/api/time.h b/include/odp/api/time.h index 50a0bf55d..efc547802 100644 --- a/include/odp/api/time.h +++ b/include/odp/api/time.h @@ -45,13 +45,28 @@ extern "C" { * Current local time * * Returns current local time stamp value. The local time source provides high - * resolution time. + * resolution time, it is initialized to zero during ODP startup and will not + * wrap around in at least 10 years. + * Local time stamps are local to the calling thread and must not be shared + * with other threads. * * @return Local time stamp. */ odp_time_t odp_time_local(void); /** + * Current global time + * + * Returns current global time stamp value. The global time source provides high + * resolution time, it is initialized to zero during ODP startup and will not + * wrap around in at least 10 years. + * Global time stamps can be shared between threads. + * + * @return Global time stamp. + */ +odp_time_t odp_time_global(void); + +/** * Time difference * * @param t2 Second time stamp @@ -90,6 +105,15 @@ uint64_t odp_time_to_ns(odp_time_t time); odp_time_t odp_time_local_from_ns(uint64_t ns); /** + * Convert nanoseconds to global time + * + * @param ns Time in nanoseconds + * + * @return Global time stamp + */ +odp_time_t odp_time_global_from_ns(uint64_t ns); + +/** * Compare two times * * @param t2 Second time @@ -100,6 +124,38 @@ odp_time_t odp_time_local_from_ns(uint64_t ns); int odp_time_cmp(odp_time_t t2, odp_time_t t1); /** + * Local time resolution in hertz + * + * @return Local time resolution in hertz + */ +uint64_t odp_time_local_res(void); + +/** + * Global time resolution in hertz + * + * @return Global time resolution in hertz + */ +uint64_t odp_time_global_res(void); + +/** + * Wait until the specified (wall clock) time has been reached + * + * The thread potentially busy loop the entire wait time. + * + * @param time Time to reach before continue + */ +void odp_time_wait_until(odp_time_t time); + +/** + * Wait the specified number of nanoseconds + * + * The thread potentially busy loop the entire wait time. + * + * @param ns Time in nanoseconds to wait + */ +void odp_time_wait_ns(uint64_t ns); + +/** * Get printable value for an odp_time_t * * @param time time to be printed |