Re: [PATCH i-g-t v5 07/11] tests/perf: make enable-disable more reliable

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

 



On 31 August 2017 at 11:35, Lionel Landwerlin
<lionel.g.landwerlin@xxxxxxxxx> wrote:
> Estimation of the amount of reports can only refer to periodic ones,
> as context switch reports completely depend on what happens on the
> system. Also generate some load to prevent clock frequency changes to
> impact our measurement.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
> ---
>  tests/perf.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 90 insertions(+), 6 deletions(-)
>
> diff --git a/tests/perf.c b/tests/perf.c
> index 15a43cf8..3b2e1763 100644
> --- a/tests/perf.c
> +++ b/tests/perf.c
> @@ -2796,10 +2796,18 @@ test_enable_disable(void)
>         int n_full_oa_reports = oa_buf_size / report_size;
>         uint64_t fill_duration = n_full_oa_reports * oa_period;
>
> +       load_helper_init();
> +       load_helper_run(HIGH);
> +
>         stream_fd = __perf_open(drm_fd, &param);
>
>         for (int i = 0; i < 5; i++) {
>                 int len;
> +               uint32_t n_periodic_reports;
> +               struct drm_i915_perf_record_header *header;
> +               uint32_t first_timestamp = 0, last_timestamp = 0;
> +               uint32_t last_periodic_report[64];
> +               double tick_per_period;
>
>                 /* Giving enough time for an overflow might help catch whether
>                  * the OA unit has been enabled even if the driver might at
> @@ -2819,18 +2827,91 @@ test_enable_disable(void)
>
>                 nanosleep(&(struct timespec){ .tv_sec = 0,
>                                               .tv_nsec = fill_duration / 2 },
> -                         NULL);
> +                       NULL);
>
> -               while ((len = read(stream_fd, buf, buf_size)) == -1 && errno == EINTR)
> -                       ;
> +               n_periodic_reports = 0;
>
> -               igt_assert_neq(len, -1);
> +               /* Because of the race condition between notification of new
> +                * reports and reports landing in memory, we need to rely on
> +                * timestamps to figure whether we've read enough of them.
> +                */
> +               while (((last_timestamp - first_timestamp) * oa_exponent_to_ns(oa_exponent)) <

(last_timestamp - first_timestamp) * oa_period

Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://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