How to understand events in NS-3 simulator

30 views
Skip to first unread message

Chinmay Bhat

unread,
Feb 1, 2017, 5:35:54 AM2/1/17
to ns-3-users
Hi All,

I'm having difficulties in understanding how events are sequentially executed in NS-3. For ex: Consider first.cc. In this program, I want to know what events are happening at what point of time. ( ex: I want to know that at what time 2 nodes are created, at what time InternetStackHelper is being installed etc.)  I tried to use all sorts of logging methods, but they are specific to some classes and we can only get the events related to those classes. How to extend it to all the events? How to get the time-diagram for every line of the code written? 

pdbarnes

unread,
Feb 1, 2017, 9:17:37 AM2/1/17
to ns-3-users
Have you read up about logging? Try

$ NS_LOG="***" ./waf ...

Another way to follow the execution exactly is by stepping through the code in a debugger.

Finally, many of the "actions" you mention (creation of nodes, installation of Internet stack) happen sequentially exactly as written in your script, before Simulator::Run (). Strictly speaking those are not "Events" in that they occur before the beginning of virtual time.

Peter

Chinmay Bhat

unread,
Feb 1, 2017, 10:24:55 AM2/1/17
to ns-3-...@googlegroups.com
Thanks a lot for the reply. I will try that command. Also i have these questions now.

1) As you have mentioned, i am trying to use GDB debugger to trace it by mentioning break points in between. But its not working properly. Please let me know is there any easy way.

2) Continuing your second point, is it possible to distinguish which part of the code is executed before Simulation::Run() command and which part is in the queue? Also , is it possible to get the sequence of events scheduled in the queue?
> --
> Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> ---
> You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/1YsLnoIREtY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.

Chinmay Bhat

unread,
Feb 1, 2017, 10:22:31 PM2/1/17
to ns-3-...@googlegroups.com
I tried the command that you have mentioned. It will give non-stop output with class and function details involved. But that seems insane. I couldn't figure what is happening. I'm not sure why it is not stopping though my run time is only for 1 s. How to control it ?
Or is there any way using Tracing technique to solve this problem. 


Gratitude 
Chinmay 

On Wed, Feb 1, 2017 at 8:54 PM, Chinmay Bhat <chinma...@gmail.com> wrote:
Thanks a lot for the reply. I will try that command. Also i have these questions now.

1) As you have mentioned, i am trying to use GDB debugger to trace it by mentioning break points in between. But its not working properly. Please let me know is there any easy way.

2) Continuing your second point, is it possible to distinguish which part of the code is executed before Simulation::Run() command and which part is in the queue? Also , is it possible to get the sequence of events scheduled in the queue?


> On 01-Feb-2017, at 7:47 PM, pdbarnes <pd...@mac.com> wrote:
>
> Have you read up about logging?  Try
>
> $ NS_LOG="***" ./waf ...
>
> Another way to follow the execution exactly is by stepping through the code in a debugger.
>
> Finally, many of the "actions" you mention (creation of nodes, installation of Internet stack) happen sequentially exactly as written in your script, before Simulator::Run ().  Strictly speaking those are not "Events" in that they occur before the beginning of virtual time.
>
> Peter
>
> --
> Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> ---
> You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/1YsLnoIREtY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

Chinmay Bhat

unread,
Feb 3, 2017, 4:15:02 AM2/3/17
to ns-3-...@googlegroups.com
Thanks for the suggestion. Logging is enough to get the details in my case. Thanks again for the suggestion. 


Gratitude 
Chinmay 
Reply all
Reply to author
Forward
0 new messages