public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/igt_core: Prefer CLOCK_MONOTONIC_RAW
@ 2015-11-17 10:24 Joonas Lahtinen
  2015-11-17 10:40 ` Chris Wilson
  0 siblings, 1 reply; 14+ messages in thread
From: Joonas Lahtinen @ 2015-11-17 10:24 UTC (permalink / raw)
  To: Intel graphics driver community testing & development; +Cc: Thomas Wood

CLOCK_MONOTONIC_RAW is not affected by NTP, so it should be THE clock
used for timing execution of tests.

Cc: Thomas Wood <thomas.wood@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 lib/igt_core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 04a0ab2..5a5b1a9 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -341,10 +341,15 @@ static void gettime(struct timespec *ts)
 {
 	memset(ts, 0, sizeof(*ts));
 
+#ifdef CLOCK_MONOTONIC_RAW
+	if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
+		return;
+#endif
 #ifdef CLOCK_MONOTONIC_COARSE
-	if (clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
+	if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
+		return;
 #endif
-		clock_gettime(CLOCK_MONOTONIC, ts);
+	clock_gettime(CLOCK_MONOTONIC, ts);
 }
 
 bool __igt_fixture(void)
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-11-23 12:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 10:24 [PATCH i-g-t] lib/igt_core: Prefer CLOCK_MONOTONIC_RAW Joonas Lahtinen
2015-11-17 10:40 ` Chris Wilson
2015-11-17 12:18   ` [PATCH i-g-t v2] " Joonas Lahtinen
2015-11-17 14:02     ` Chris Wilson
2015-11-18 12:18       ` [PATCH i-g-t v3] " Joonas Lahtinen
2015-11-18 12:28         ` Chris Wilson
2015-11-18 12:54           ` Joonas Lahtinen
2015-11-18 13:07             ` Chris Wilson
2015-11-19 11:00               ` [PATCH i-g-t v4] " Joonas Lahtinen
2015-11-19 11:43                 ` Chris Wilson
2015-11-20 11:26                   ` [PATCH i-g-t v5] " Joonas Lahtinen
2015-11-20 11:38                     ` Chris Wilson
2015-11-20 11:57                       ` [PATCH i-g-t v6] " Joonas Lahtinen
2015-11-23 12:52                         ` Joonas Lahtinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox