Queue length

1,416 views
Skip to first unread message

David Patric

unread,
Mar 18, 2014, 10:05:16 AM3/18/14
to ns-3-...@googlegroups.com
Hello all,
Can anyone pls help me to find the queue length during the simulation time at every 5 seconds lets say, i tried to look into the trace source and unfortunately i could not find any trace source for queue length....is there any other way i can do it???

thanks in advance

with regards
David

Konstantinos

unread,
Mar 18, 2014, 10:40:50 AM3/18/14
to ns-3-...@googlegroups.com
There is a method to get the number of packets directly, no need for trace source. So, you can schedule an event to get the number of packets (or bytes) in that queue.

uint32_t ns3::Queue::GetNPackets(void )const
Returns
The number of packets currently stored in the Queue

Definition at line 125 of file queue.cc.


Regards,
K.

vyshak srivatsa

unread,
Mar 18, 2014, 11:43:14 PM3/18/14
to ns-3-...@googlegroups.com
How can i compute queue length at particular node using this ?? presently i am doing  it using WifiMacQueue class in the following way
   PointerValue ptr;
   wd->GetAttribute ("Mac",ptr); //(wd is pointer to wifinetdevice which has an interface to node)
   Ptr<AdhocWifiMac> mac = ptr.Get<AdhocWifiMac> ();
   NS_ASSERT (mac != NULL);
 
   mac->GetAttribute ("DcaTxop",ptr);
   Ptr<DcaTxop> dca = ptr.Get<DcaTxop> ();
   NS_ASSERT (dca != NULL);
  
   Ptr<WifiMacQueue> queue = dca->GetQueue ();
   NS_ASSERT (queue != NULL);
   queue->GetSize ();

but i feel its not working properly because i am always getting queue length as 0

can you please tell me how can i do it from the class which you said above ??


Thnaks in advance
David


--
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/4Y4GrSNWHJI/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Mar 19, 2014, 2:28:58 AM3/19/14
to ns-3-...@googlegroups.com
Hi,

finding a queue size zero is normal, unless you:
1) are in saturated condition (i.e., there is a congestion), or
2) you're in a temporary congestion (i.e., there is a temporary burst of packets or collisions).

The two above conditions are heavily dependant on the traffic model.

If you don't carefully select your scenario, your queue length will be zero (or one, when you're sending one packet).

However this is not an ns-3 thing, it's network queueing systems 101.

T.

scabbicalboss

unread,
Feb 23, 2015, 12:43:16 AM2/23/15
to ns-3-...@googlegroups.com


On Tuesday, 18 March 2014 10:40:50 UTC-4, Konstantinos wrote:
There is a method to get the number of packets directly, no need for trace source. So, you can schedule an event to get the number of packets (or bytes) in that queue.

uint32_t ns3::Queue::GetNPackets(void )const
Returns
The number of packets currently stored in the Queue

Definition at line 125 of file queue.cc.



 Hey Konstantinos, quick question. How do you schedule an event to get the number of packets (or bytes) in a queue?, i'm having some trouble with this.

Konstantinos

unread,
Feb 23, 2015, 4:00:01 AM2/23/15
to ns-3-...@googlegroups.com
Please read the manual and see other examples in the ns-3
Reply all
Reply to author
Forward
0 new messages