[LTP] [RFC] [PATCH] pselect01: Tune thresholds

Jan Stancek jstancek@redhat.com
Fri May 12 09:11:47 CEST 2017



----- Original Message -----
> Hi!
> > > +static int compute_threshold(long long requested_us, unsigned int
> > > iterations)
> > > +{
> > > +	unsigned int slack_per_run = MIN(100000, requested_us / 1000);
> > > +
> > > +	return (40 + slack_per_run) * iterations + 20000 / (iterations/200 +
> > > 1);
> > > +}
> > 
> >   requested_us = tst_timespec_to_us(t->tv) * t->iterations;
> > 
> > If slack_per_run is slack of all iterations, why is it multiplied
> > again with number of iterations?
> 
> That variable is poorly named. It should have been slack_per_call or
> slack_per_iteration. It's slack per one syscall computed using the same
> formula that is used in kernel...

If it's per iteration, shouldn't this function be passed time per iteration?
At the moment, it's time of all iterations:
  requested_us = tst_timespec_to_us(t->tv) * t->iterations;
  threshold = compute_threshold(requested_us, t->iterations);

Should it be ... ?
  threshold = compute_threshold(tst_timespec_to_us(t->tv), t->iterations);

Regards,
Jan


More information about the ltp mailing list