[ovs-dev] [PATCH] datapath: Don't query time for every packet.

Ben Pfaff blp at nicira.com
Thu Jul 22 20:45:55 UTC 2010


On Thu, Jul 22, 2010 at 12:32:56PM -0700, Jesse Gross wrote:
> On Thu, Jul 22, 2010 at 10:39 AM, Ben Pfaff <blp at nicira.com> wrote:
> > On Wed, Jul 21, 2010 at 07:36:15PM -0700, Jesse Gross wrote:
> > > +             used = timespec_sub(now, delta);
> >
> > 'now' is an absolute time.
> > I think that 'delta' is an absolute time.
> > 'used' is supposed to be an absolute time (on the monotonic clock),
> > too.
> > But I think that this subtraction will yield a duration relative to the
> > current time.  I don't think that's correct.
> 
> 
> delta is a relative time: it comes from subtracting flow->used from jiffies
> so it is the length of time since the flow was used.  Subtracting that from
> the current time yields the absolute time when the flow was used.  In other
> words, ignoring the different units:
> 
> current - (current - used) = used

OK, I see.  We're converting between two scales based on a fixed point
and a conversion factor, like converting between Fahrenheit and Celsius
by knowing that 32 F = 0 C and that there are 1.8 degF per degC.  But
instead of using a *fixed* fixed point, like 32 F = 0 C, we're using a
*variable* fixed point.  It's like, every time you want to convert
between temperature scales, walking over to the thermometer and reading
off that it's currently 72 degF and 22 degC and writing out a new
equation based on those facts.

So: can we used a *fixed* fixed point somehow?  It would be cheaper than
obtaining the current time for every conversion, and it might be more
accurate.




More information about the dev mailing list