[Intel-gfx] [PATCH i-g-t v3] lib/igt_core: Prefer CLOCK_MONOTONIC_RAW
Chris Wilson
chris at chris-wilson.co.uk
Wed Nov 18 04:28:58 PST 2015
On Wed, Nov 18, 2015 at 02:18:52PM +0200, Joonas Lahtinen wrote:
> CLOCK_MONOTONIC_RAW is not affected by NTP, so it should be THE clock
> used for timing execution of tests.
>
> When fetching either the starting or ending time of a test, show the
> time as -1.000s.
>
> v3:
> - Do not exit directly from handler (Chris)
> - Show elapsed time as -1 if it is not calculable
Aye, that's better for the subtest handling.
> @@ -832,10 +851,16 @@ static void exit_subtest(const char *result)
> {
> struct timespec now;
> double elapsed;
> + int err;
>
> - gettime(&now);
> - elapsed = now.tv_sec - subtest_time.tv_sec;
> - elapsed += (now.tv_nsec - subtest_time.tv_nsec) * 1e-9;
> + err = gettime(&now);
> + if (!err && subtest_time.tv_sec != 0 &&
> + subtest_time.tv_nsec != 0) {
A little paranoid? If we want the paranoia perhaps move it to gettime
and return an error?
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list