summaryrefslogtreecommitdiff
path: root/lib/igt_aux.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-08-01 12:58:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-08-01 13:04:29 +0100
commit12f052b5604fffb852bf66250b89fec56641733c (patch)
tree2d0e716994c0c8ca7a409d835140c3462c05557c /lib/igt_aux.h
parent29eac70683fb15188c595e6e7e7fdb4085a7eb06 (diff)
igt/gem_mmap_gtt/wc: Reduce test runtime
Add a new iterator macro to run for a specified number of milliseconds. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_aux.h')
-rw-r--r--lib/igt_aux.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 5627cb04..7f5a7cfd 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -85,6 +85,19 @@ bool __igt_sigiter_continue(struct __igt_sigiter *iter, bool interrupt);
#define igt_until_timeout(timeout) \
for (struct timespec t__={}; igt_seconds_elapsed(&t__) < (timeout); )
+/**
+ * igt_for_milliseconds:
+ * @time: how long to run the loop in milliseconds
+ *
+ * Convenience macro loop to run the provided code block in a loop until the
+ * target interval has expired. Of course when an individual execution takes
+ * too long, the actual execution time could be a lot longer.
+ *
+ * The code block will be executed at least once.
+ */
+#define igt_for_milliseconds(t) \
+ for (struct timespec t__={}; igt_nsec_elapsed(&t__)>>20 < (t); )
+
void igt_exchange_int(void *array, unsigned i, unsigned j);
void igt_permute_array(void *array, unsigned size,
void (*exchange_func)(void *array,