diff mbox series

[API-NEXT,v1,1/3] api: time: time difference in nsec

Message ID 1511528406-25262-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/3] api: time: time difference in nsec | expand

Commit Message

Github ODP bot Nov. 24, 2017, 1 p.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Added function which returns time difference in nanoseconds.
This short cuts a common pattern...

t1 = odp_time_global();
foo();
t2 = odp_time_global();
printf("foo() takes %u nsec\n", odp_time_diff_ns(t2, t1);

... by combining convert and diff functions.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 310 (psavol:next-time-convert)
 ** https://github.com/Linaro/odp/pull/310
 ** Patch: https://github.com/Linaro/odp/pull/310.patch
 ** Base sha: b95e7d08043ba45d12635c5afaa3fbf3a07ecc90
 ** Merge commit sha: 7700d0dab4af4db47973c2a88e5a6d6765bf979e
 **/
 include/odp/api/spec/time.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h
index 29175eb5a..50082f53a 100644
--- a/include/odp/api/spec/time.h
+++ b/include/odp/api/spec/time.h
@@ -76,6 +76,16 @@  odp_time_t odp_time_global(void);
  */
 odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1);
 
+/**
+ * Time difference in nanoseconds
+ *
+ * @param t2    Second time stamp
+ * @param t1    First time stamp
+ *
+ * @return Difference of time stamps (t2 - t1) in nanoseconds
+ */
+uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1);
+
 /**
  * Time sum
  *