[ndnSIM] Print Queue length
Alex Afanasyev
alexander.afanasyev at ucla.edu
Thu Dec 5 15:49:57 PST 2013
Are you sure that you have anything in queue? Do you have bursts or traffic/are you links fully saturated all the time?
---
Alex
On Dec 5, 2013, at 3:44 PM, Amin Karami <amin at ac.upc.edu> wrote:
> Yes, I used this code:
>
> // get current queue size
> uint32_t k;
> Ptr<ndn::Pit> pit = node->GetObject<ndn::Pit> ();
> Ptr<Channel> CH1 = node->GetDevice(2)->GetChannel();
> Ptr<NetDevice> toDev = CH1->GetDevice (1);
> PointerValue txQueue;
> toDev->GetAttribute ("TxQueue", txQueue);
> k = txQueue.Get<DropTailQueue> ()->GetNPackets();
>
>
> When i print "k", it is zero. Is there any wrong in my code? If my code is true, i may call wrong GetDevice number!
>
> /Amin
>
>
> On 12/06/2013 12:17 ق.ظ, Ilya Moiseenko wrote:
>> The parent class Queue has a method “GetNPackets”
>> http://www.nsnam.org/docs/release/3.18/doxygen/classns3_1_1_queue.html#a50dcb693d5325708d8c90770f795eabc
>>
>> Ilya
>>
>> On Dec 5, 2013, at 3:10 PM, Amin Karami <amin at ac.upc.edu> wrote:
>>
>>> Hi llya!
>>> I want to print the number of filled elements in queue in an interface in a specific time, not original (predefined) size of the queue. I think, i posted wrong title for my question :-)
>>> I could not find related attribute in your suggested link. I found these attributes: Mode, MaxPackets, MaxBytes
>>>
>>> Is there any suggestion?
>>>
>>>
>>> Thank you in advance.
>>>
>>> /Amin
>>>
>>> On 12/05/2013 07:59 ب.ظ, Ilya Moiseenko wrote:
>>>> Hi Amin
>>>>
>>>> 1) m_maxPackets is indeed private.
>>>> However, you can access this value by attribute named “MaxPackets"
>>>> See http://www.nsnam.org/docs/release/3.18/doxygen/classns3_1_1_drop_tail_queue.html for details
>>>>
>>>> 2) Technically you can do this in NS3. And in real life routers can have different queue sizes.
>>>>
>>>>
>>>> Ilya
>>>>
>>>> On Dec 4, 2013, at 2:35 AM, Amin Karami <amin at ac.upc.edu> wrote:
>>>>
>>>>> Hi Alex,
>>>>> I am going to print Queue length in a specific interface of a router. I wrote below function:
>>>>>
>>>>> void PeriodicStatsPrinter (Ptr<Node> node, Time next)
>>>>> Ptr<ndn::Pit> pit = node->GetObject<ndn::Pit> ();
>>>>> Ptr<Channel> CH = node->GetDevice(2)->GetChannel(); \\ 2nd interface of the node
>>>>> Ptr<NetDevice> toDev = CH->GetDevice (1); \\ access to its queue
>>>>> PointerValue txQueue;
>>>>> toDev->GetAttribute ("TxQueue", txQueue);
>>>>> std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"
>>>>> << Names::FindName (node) << "\t"
>>>>> << "Max Packets of Queue: " << txQueue.Get<DropTailQueue> ()->m_maxPackets << "\n";
>>>>>
>>>>> 1- But, i faced with this error:
>>>>> ../scratch/RTT/RTT.cc: In function ‘void PeriodicStatsPrinter(ns3::Ptr<ns3::Node>, ns3::Time)’:
>>>>> ../scratch/RTT/RTT.cc:44:6: error: expected primary-expression before ‘<<’ token
>>>>> ./ns3/drop-tail-queue.h:68:12: error: ‘uint32_t ns3::DropTailQueue::m_maxPackets’ is private
>>>>> ../scratch/RTT/RTT.cc:44:58: error: within this context
>>>>>
>>>>> 2- Could i define two Queue lengths for a specific interface in routers? from inside and outside of a link. Or both should be equal?
>>>>>
>>>>>
>>>>> /Amin
>>>>> _______________________________________________
>>>>> ndnSIM mailing list
>>>>> ndnSIM at lists.cs.ucla.edu
>>>>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
>>
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20131205/61831582/attachment.html>
More information about the ndnSIM
mailing list