> --- a/include/odp/api/time.h
> +++ b/include/odp/api/time.h
> @@ -28,14 +28,22 @@ extern "C" {
> #define ODP_TIME_MSEC 1000000ULL /**< Millisecond in nsec */
> #define ODP_TIME_SEC 1000000000ULL /**< Second in nsec */
Now with abstract time these defines should highlight that they are nano
seconds, not abstract time. Renaming can be done in another patch set.
>
> +/**
> + * @typedef odp_time_t
> + * ODP time stamp. Time stamp is global and can be shared between threads.
> + */
>
> /**
> - * Current time in CPU cycles
> - *
> - * @return Current time in CPU cycles
> + * @def ODP_TIME_NULL
> + * Zero time stamp
> */
> -uint64_t odp_time_cycles(void);
>
> +/**
> + * Current global time stamp.
> + *
> + * @return Time stamp. It should be hi-resolution time.
This "It should be hi-resolution time." belongs to documentation body (next
line/paragraph after the first sentence)
> + */
> +odp_time_t odp_time(void);
>
> /**
> * Time difference
> @@ -43,29 +51,60 @@ uint64_t odp_time_cycles(void);
> * @param t1 First time stamp
> * @param t2 Second time stamp
> *
> - * @return Difference of time stamps in CPU cycles
> + * @return Difference of time stamps
> */
> -uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2);
> +odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2);
>
> +/**
> + * Time sum
> + *
> + * @param t1 time stamp
> + * @param t2 time stamp
Capital 'T' => "Time stamp"
> + *
> + * @return Sum of time stamps
> + */
> +odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2);
>
> /**
> - * Convert CPU cycles to nanoseconds
> + * Convert time to nanoseconds
> *
Returned nanosecond time starts from 0 in ODP startup, so that this value will
not wrap.
-Petri
> - * @param cycles Time in CPU cycles
> + * @param time Time
> *
> * @return Time in nanoseconds
> */
> -uint64_t odp_time_cycles_to_ns(uint64_t cycles);
> -
> +uint64_t odp_time_to_ns(odp_time_t time);
>
> /**
> - * Convert nanoseconds to CPU cycles
> + * Convert nanoseconds to time
> *
> * @param ns Time in nanoseconds
> *
> - * @return Time in CPU cycles
> + * @return Time stamp
> + */
> +odp_time_t odp_time_from_ns(uint64_t ns);
> +
> +/**
> + * Compare two times as absolute ranges
> + *
> + * @param t1 First time
> + * @param t2 Second time
> + *
> + * @retval -1 if t2 < t1, 0 if t1 = t2, 1 if t2 > t1
> + */
> +int odp_time_cmp(odp_time_t t1, odp_time_t t2);
> +
> +/**
> + * Get printable value for an odp_time_t
> + *
> + * @param time time to be printed
> + * @return uint64_t value that can be used to print/display this
> + * time
> + *
> + * @note This routine is intended to be used for diagnostic purposes
> + * to enable applications to generate a printable value that represents
> + * an odp_time_t time.
> */
> -uint64_t odp_time_ns_to_cycles(uint64_t ns);
> +uint64_t odp_time_to_u64(odp_time_t time);
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp