[igt-dev] [PATCH i-g-t] tests/kms_flip: Print timevals as float

Chris Wilson chris at chris-wilson.co.uk
Fri Jul 6 14:56:06 UTC 2018


Quoting Ville Syrjala (2018-07-06 15:50:48)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Time intervals as produced by timersub() are normalized to have
> the tv_usec in the range 0-999999. That leads to very confusing
> looking debug output for negative interval. Eg. an interval
> of -0.1 seconds would be represented as tv_sec=-1, tv_usec=900000.
> Let's just convert the thing to a float seconds value and print
> that so that we'll get less confusing debug output.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  tests/kms_flip.c | 43 +++++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index 3d6fe948d3bb..393d690ab535 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -125,23 +125,28 @@ struct event_state {
>         int seq_step;
>  };
>  
> +static float timeval_float(const struct timeval *tv)
> +{
> +       return tv->tv_sec + tv->tv_usec / 1000000.0f;
> +}
> +
>  static void dump_event_state(const struct event_state *es)
>  {
>         igt_debug("name = %s\n"
> -                 "last_ts = %ld.%06ld\n"
> -                 "last_received_ts = %ld.%06ld\n"
> +                 "last_ts = %.06f\n"
> +                 "last_received_ts = %.06f\n"

Bikeshed time. We expect differences to be on the ms range, so
%.03fms and timeval_ms()?

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list