[Ns-developers] Internal Time Keeping Question

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Mon Jul 21 09:45:48 PDT 2008


On Mon, 2008-07-21 at 10:16 +0200, Hagen Paul Pfeifer wrote:
> As nobody is in chat I redirect the question/assumption/ideas to the
> maillinglist.
> 
> Currently there are two distinct time implementation one with 64bit and one
> 128 bit high precision (src/simulator/high-precision-128.cc, libcairo

There are currently two implementations of the HighPrecision API:
  - one is integer-based and uses 64.64 (128 bits with 64 bits of
fractional part) values
  - one is double-based and uses doubles

The first one is "optimized" to use a 64 bit value internally if there
is no fractional part.

> based).  I an not sure at the moment if it is necessary to synchronize the
> 128bit values (m_slowValue) or use the faster counterpart?

The HighPrecision/Time API is used to help users make time calculations,
not to keep track of the simulation time. The simulation time is a 64
bit counter while the HighPrecision time is a counter with a higher
precision (to allow you to do multiplications, divisions, etc.)

So, it all depends what you want to exchange. If you want to exchange
user time across machines, you should use the value stored internally in
the HighPrecision class (which means that you need access to all fields
m_slowValue, m_fastValue, and m_isFast). If you want to exchange the
simulation time, then, don't bother with all this: just exchange the
internal 64 bit counter you get from Time.GetHighPrecision ().GetInteger
().

I suspect very much that you are in the latter case.

> My current idea is to add a bitfield in the ParaPacket Header ("128bit
> mode") to signal the precision and transmit the 128bit or in the other case
> a 64 bit width value. This field becomes the linchpin of the time
> synchronization.

I see no reason why you would want to transmit the fractional part of
the time. How do you obtain the Time instance you want to transmit ?

Mathieu



More information about the Ns-developers mailing list