[Intel-gfx] [PATCH i-g-t v4] lib/igt_core: Prefer CLOCK_MONOTONIC_RAW
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 19 03:43:53 PST 2015
On Thu, Nov 19, 2015 at 01:00:07PM +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.
>
> v4:
> - Introduce time_valid macro (Chris)
> - Reduce amount of boilerplate code for calculating elapsed time
>
> v3:
> - Do not exit directly from handler (Chris)
> - Show elapsed time as -1 if it is not calculable
>
> v2:
> - Cache the used clock (Chris)
> - Do not change the clock during execution
> - Spit out and error if monotonic time can not be read
>
> Cc: Thomas Wood <thomas.wood at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> +static int gettime(struct timespec *ts)
> {
> memset(ts, 0, sizeof(*ts));
> + errno = 0;
>
> + // Stay on the same clock for consistency.
We avoid using "//" for comments, even for single lines.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list