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

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Jul 6 16:17:04 UTC 2018


On Fri, Jul 06, 2018 at 03:56:06PM +0100, Chris Wilson wrote:
> 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()?

I guess that might be a decent idea. Although it rather makes
me want to switch over to float msecs everywhere in the test.

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list