Re: [igt-dev] [PATCH i-g-t] lib/igt_perf: Request CLOCK_MONOTONIC when opening events

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

 



Quoting Tvrtko Ursulin (2020-12-18 08:49:39)
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> Ask for CLOCK_MONOTONIC which is more stable than the default perf clock.
> 
> (Ability to select a clock has been available since kernel version 4.1.)
> 
> The change should not have any significant impact on the IGT as whole
> apart from maybe improving the occasional jitter in tests/tools which use
> nanosleep(2) and use time slept together with perf reported time delta
> either in direct or indirect calculations.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> ---
>  lib/igt_perf.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_perf.c b/lib/igt_perf.c
> index 418c1c18891c..b743859f5d29 100644
> --- a/lib/igt_perf.c
> +++ b/lib/igt_perf.c
> @@ -1,12 +1,13 @@
> -#include <stdint.h>
> +#include <errno.h>
>  #include <fcntl.h>
> -#include <unistd.h>
> +#include <stdint.h>
>  #include <stdlib.h>
>  #include <string.h>
> -#include <errno.h>
>  #include <sys/stat.h>
>  #include <sys/sysinfo.h>
>  #include <sys/sysmacros.h>
> +#include <time.h>
> +#include <unistd.h>
>  
>  #include "igt_perf.h"
>  
> @@ -111,6 +112,8 @@ _perf_open(uint64_t type, uint64_t config, int group, uint64_t format)
>  
>         attr.read_format = format;
>         attr.config = config;
> +       attr.use_clockid = 1;
> +       attr.clockid = CLOCK_MONOTONIC;

Ok, pretty much all are cumulative samples with ktime_get(), and not raw
HW clocks that would prefer MONO_RAW.
Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux