Re: [PATCH 2/3] trace-cmd: Read and use fraction bits from TRACECMD_OPTION_TIME_SHIFT

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

 



On Wed, Oct 13, 2021 at 6:14 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Thu, 23 Sep 2021 12:45:25 +0300
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:
>
> > @@ -1235,7 +1236,6 @@ timestamp_correction_calc(unsigned long long ts, unsigned int flags,
> >                         struct ts_offset_sample *min,
> >                         struct ts_offset_sample *max)
> >  {
> > -     long long scaling;
> >       long long tscor;
> >
> >       if (flags & TRACECMD_TSYNC_FLAG_INTERPOLATE) {
> > @@ -1243,15 +1243,12 @@ timestamp_correction_calc(unsigned long long ts, unsigned int flags,
> >               long long offset = ((long long)ts - min->time) *
> >                                  (max->offset - min->offset);
> >
> > -             scaling = (min->scaling + max->scaling) / 2;
>
> So the max->scaling is not going to play a role here?

I assume that if there is a clock scaling - it should not change
runtime, fraction bits and scaling should be the same from the VM
start. So there is no sense to make interpolation, just use the first
value.

>
> Does this work for other methods besides KVM?
>

We have only PTP and KVM till now, only KVM supports scaling. PTP just
sets scaling to 1 and fraction to 0. Unfortunately, I cannot test even
KVM scaling - I failed to enable it on my system.

> -- Steve
>
>
> >               tscor = min->offset + (offset + delta / 2) / delta;
> > -
> >       } else {
> > -             scaling = min->scaling;
> >               tscor = min->offset;
> >       }
> >
> > -     ts *= scaling;
> > +     ts = (ts * min->scaling) >> min->fraction;
> >       if (tscor < 0)
> >               return ts - llabs(tscor);
> >
> > @@ -2337,37 +2334,16 @@ static int tsync_offset_cmp(const void *a, const void *b)
> >



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux