diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-07-19 19:46:02 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-07-19 20:00:11 -0400 |
commit | 7ae970e73bc1d026bbf65a82c066aab79c860fe8 (patch) | |
tree | dbc28229098af78b92996dbcb6b41663598bfcbe /include | |
parent | cf1d1f6e4b1138a5a841a47a2cba4aacdcaf0d72 (diff) |
Add sleep_until_mono(), lt_sleep_until() helpers
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/litmus.h b/include/litmus.h index 70e7552..751b5ec 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
@@ -158,6 +158,10 @@ int sporadic_clustered(lt_t e_ns, lt_t p_ns, int cluster); | |||
158 | * @param us Time units in microseconds */ | 158 | * @param us Time units in microseconds */ |
159 | #define us2ns(us) ((us)*1000LL) | 159 | #define us2ns(us) ((us)*1000LL) |
160 | 160 | ||
161 | /** Convert nanoseconds to seconds (truncating) | ||
162 | * @param ns Time units in nanoseconds */ | ||
163 | #define ns2s(ns) ((ns)/1000000000LL) | ||
164 | |||
161 | /** | 165 | /** |
162 | * Locking protocols for allocated shared objects | 166 | * Locking protocols for allocated shared objects |
163 | */ | 167 | */ |
@@ -330,6 +334,13 @@ int read_litmus_stats(int *ready, int *total); | |||
330 | int lt_sleep(lt_t timeout); | 334 | int lt_sleep(lt_t timeout); |
331 | 335 | ||
332 | /** | 336 | /** |
337 | * Sleep until the given point in time. | ||
338 | * @param wake_up_time Point in time when to wake up (w.r.t. CLOCK_MONOTONIC, | ||
339 | * in nanoseconds). | ||
340 | */ | ||
341 | void lt_sleep_until(lt_t wake_up_time); | ||
342 | |||
343 | /** | ||
333 | * Obtain CPU time consumed so far | 344 | * Obtain CPU time consumed so far |
334 | * @return CPU time in seconds | 345 | * @return CPU time in seconds |
335 | */ | 346 | */ |
@@ -347,6 +358,18 @@ double wctime(void); | |||
347 | */ | 358 | */ |
348 | double monotime(void); | 359 | double monotime(void); |
349 | 360 | ||
361 | /** | ||
362 | * Sleep until the given point in time. | ||
363 | * @param wake_up_time Point in time when to wake up (w.r.t. CLOCK_MONOTONIC) | ||
364 | */ | ||
365 | void sleep_until_mono(double wake_up_time); | ||
366 | |||
367 | /** | ||
368 | * Sleep until the given point in time. | ||
369 | * @param wake_up_time Point in time when to wake up (w.r.t. CLOCK_REALTIME) | ||
370 | */ | ||
371 | void sleep_until_wc(double wake_up_time); | ||
372 | |||
350 | /***** semaphore allocation ******/ | 373 | /***** semaphore allocation ******/ |
351 | /** | 374 | /** |
352 | * Allocate a semaphore following the FMLP protocol | 375 | * Allocate a semaphore following the FMLP protocol |