[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
time-travel ?
> Unless I am mistaken, it seems that
> scheduler.cc allows events to be scheduled
> in the "past". That is s.schedule( x, y, t) can be called with t
> being negative. When this event gets scheduled, the simulation time
> travels backwards (as t was negative).
>
> Is this feature deliberate or just an oversight ?
>
> I discovered this while trying to debug ns-2/ll.cc.
> It was scheduling an &intr after a negative interval - the scheduler
> does not complain. However, one side-effect of this is that
> the event times in the trace files are no more non-decreasing.
> This is, to say the least, very annoying, and can perhaps yield
> erroneous results (by re-ordering events in a non-causal order).
>
> I would suggest adding a check (and warning) for (clock_ <= t) in
> Scheduler::dispatch(p,t) -- may be assert(clock_<=t).
> This would help in catching some bugs.
There is a bug in ll.cc that schedule a negative time. I have fixed it
and checked in ll.cc. If you use the distribution instead of direct
access to the CVS tree change the line 129 of ll.cc to this:
s.schedule(h, &intr_, txtime(p));
In term of negative time dispatching, I agree that there should be a
check and warning.
Giao