Flow Monitor taking too long

91 views
Skip to first unread message

Soulimane Mammar

unread,
Jan 28, 2022, 5:57:50 PM1/28/22
to ns-3-users
Hi,
I'm trying to collect some stat data using Flow Monitor. The problem is that even with a very simple topology (2 nodes) and a simulation time of 15 sec the process is taking too much time (till now the simulation is running for several hours and no results back yet)
Is this normal ?
Regards

Gabriel

unread,
Jan 28, 2022, 8:54:34 PM1/28/22
to ns-3-users
Not normal. Did you set Simulator::Stop(Seconds(15.0))?
Or maybe you did one infinite loop? If it is just a for, easy to find with a debugger.
Otherwise, use a profiler to find out where the program is spending its time. If you're on linux, try sysprof: https://wiki.gnome.org/Apps/Sysprof 

Soulimane Mammar

unread,
Jan 29, 2022, 3:34:13 AM1/29/22
to ns-3-users
No, in my script all the applications stop sending their traffic within 15 sec (so in theory after 15s there will be no events ).
After several hours the simulation crashed with  the message error 

assert failed. cond="next.key.m_ts >= m_currentTs", -0.709551616s -1 file=../src/core/model/default-simulator-impl.cc, line=143
terminate called without an active exception

Syprof shows that the Flow Monitor is consuming almost all cpu cycles (see attached screenshot)
sysprof.png

Soulimane Mammar

unread,
Jan 29, 2022, 6:52:09 AM1/29/22
to ns-3-users
After all, I had to explicitly add Simulator::Stop() to my simulation script and not counting on the fact that after the applications stop the event list will be empty

Gabriel

unread,
Jan 29, 2022, 8:50:51 AM1/29/22
to ns-3-users
Based on the assert, you just had an overflow (negative timestamps).
Based on sysprof, you would never run out of events since Flow Monitor is creating more to check the network periodically.

Soulimane Mammar

unread,
Jan 30, 2022, 12:47:24 PM1/30/22
to ns-3-users
Flow Monitor is an outside observer and in theory it should not place events. In practice, I guess this is not possible unless implementing a meta simulator that runs the simulator itself and any other observer entity

Gabriel Ferreira

unread,
Jan 31, 2022, 8:46:31 AM1/31/22
to ns-3-users
I do agree. Maybe we could count non-observing events in the event queue and interrupt the simulation if it ever reached 0, assuming observing events can't schedule a non-observing event.
Doesn't sound that bad in terms of performance and should work fine in most cases. 

Soulimane Mammar

unread,
Feb 1, 2022, 11:11:06 AM2/1/22
to ns-3-users
Sounds Great. As soon as I'll finish my actual work, perhaps I'll dedicate some time to contribute to ns3 code ;-)
Reply all
Reply to author
Forward
0 new messages