Re: [PATCH i-g-t v3] lib/igt_core: Prefer CLOCK_MONOTONIC_RAW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux