How to trace "PacketsInQueue" for QueueDiscs

580 views
Skip to first unread message

Vignesh K

unread,
May 25, 2021, 10:06:22 AM5/25/21
to ns-3-users

Hello everyone,

I'm struggling to find the number of packets in the queuediscs. I find that there is a trace source available for this as shown in the picture (PFA). However in the description, it is mentioned that "Introspection did not find any typical Config paths.". In such case, I don't know how to trace the value. Pls. let me know your inputs.
ns3_doubt.png

Li, Ye

unread,
May 26, 2021, 2:45:36 AM5/26/21
to ns-3-...@googlegroups.com
Hi,

Please note that connecting to the QueueDisc traces should be done after assigning IP addresses. On the other hand, if you would like to change the default traffic-control queue disciplines, this should be done before assigning IP addresses. You may read through the documentation here:


On Tue, May 25, 2021 at 10:06 PM Vignesh K <smiley...@gmail.com> wrote:

Hello everyone,

I'm struggling to find the number of packets in the queuediscs. I find that there is a trace source available for this as shown in the picture (PFA). However in the description, it is mentioned that "Introspection did not find any typical Config paths.". In such case, I don't know how to trace the value. Pls. let me know your inputs.

--
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 the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/2d84bf0b-229f-420a-b41e-a44f9ef490f5n%40googlegroups.com.


--

Vignesh K

unread,
May 26, 2021, 9:45:12 AM5/26/21
to ns-3-users
Hi Li!

Thank you so much for your inputs providing insights on traffic control, QDisc and netdevice relations. I'm tryig to simulate strict priority queueing between two nodes and I used traffic control helper and ns3::PrioQueueDisc to achieve this. I have mentioned the priomap with low priority for value "0" and high priority for rest of the 15 values (1-15). I also added two internal queues connected to the childqueuediscs to handle low priority packets on one queue and high priority packets on another queue. I have run the simulation such that during the bottleneck the low prioirty packets are dropped and high priority packets are not dropped.

QDISC_doubt.png

Bottleneck scenario:

p2p link rate < (low prio. datarate and high prio. datarate). (Al and A2 are low and high priority traffic generators)

Now I'm facing issues in tracing the queue lengths of the internal queue(s). Please find the attachment, Line 167-177, I can able to trace the root queue disc (summation of internal queue length values, I assumed) length and driver queue length, however I cannot able to trace the internal queue lengths. Kindly let me know if I misunderstood the concept anywhere. Pls. let me know where I'm doing wrong.

Thanks and regards,
Vignesh!
QueueDisc.cc

Vignesh K

unread,
May 31, 2021, 4:28:45 AM5/31/21
to ns-3-users
Hello everyone,

Kindly please find the description of the issue in the above mail thread.

I'm unable to trace the packets in queue of the child queue discs. In NS3 documentation, it is mentioned with respect to the Root queue discs,

/NodeList/[i]/$ns3::TrafficControlLayer/RootQueueDiscList/[j]/InternalQueueList/1

I tried this in my code and I receive the following error,

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007fffedbeb921 in __GI_abort () at abort.c:79
#2  0x00007fffee7fd957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007fffee803ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007fffee803b21 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007fffeeeb5e6a in ns3::Config::ConnectWithoutContext (
    path="/NodeList/0/$ns3::TrafficControlLayer/RootQueueDiscList/*/InternalQueueList/0/PacketsInQueue", cb=...) at ../src/core/model/config.cc:904
#6  0x0000555555579b9b in main (argc=12, argv=0x7fffffffdad8)
    at ../scratch/eth_common/eth_common.cc:900

However I can able to get the childqueuediscs -> Packetsinqueue using the following code,

void
QdiscAccess (Ptr<NetDevice> dev, Ptr<OutputStreamWrapper> childQueues)
{

    Ptr<TrafficControlLayer> tc = dev->GetNode ()->GetObject<TrafficControlLayer> ();
    Ptr<QueueDisc> qdisc = tc->GetRootQueueDiscOnDevice (dev);
//    std::cout<<"RootQueueLength: "<< qdisc->GetNPackets () <<"\tTime: "<<Simulator::Now()<<std::endl;
//    std::cout<<"ChildQueueLength 1: "<< qdisc->GetQueueDiscClass(0)->GetQueueDisc()->GetNPackets() <<"\tTime: "<<Simulator::Now()<<std::endl;
//    std::cout<<"ChildQueueLength 2: "<< qdisc->GetQueueDiscClass(1)->GetQueueDisc()->GetNPackets() <<"\tTime: "<<Simulator::Now()<<std::endl;
    *childQueues->GetStream () << Simulator::Now()<< "\t"  << qdisc->GetQueueDiscClass(0)->GetQueueDisc()->GetNPackets() << "\t" << qdisc->GetQueueDiscClass(1)->GetQueueDisc()->GetNPackets() << std::endl;
    Simulator::Schedule(Seconds(0.00001),&QdiscAccess, dev, childQueues);
}

The implementation is similar to this,

doubt_1.png

But I would like to do this using config path.

Can someone let me know what I'm missing here.

Thanks,
Vignesh.

Tom Henderson

unread,
May 31, 2021, 11:36:00 PM5/31/21
to ns-3-...@googlegroups.com, Vignesh K
On 5/31/21 1:28 AM, Vignesh K wrote:
> Hello everyone,
>
> Kindly please find the description of the issue in the above mail thread.
>
> I'm unable to trace the packets in queue of the child queue discs. In
> NS3 documentation, it is mentioned with respect to the Root queue discs,
>
> https://www.nsnam.org/docs/models/html/queue-discs.html#fig-multi-queue-aware-queue-disc
> /NodeList/[i]/$ns3::TrafficControlLayer/RootQueueDiscList/[j]/InternalQueueList/1

I don't see any documented examples in the mainline code for this type
of tracing; I only see an example of Config::Connect in the example
program traffic-control.cc, but that is for the root QueueDisc.

What I would recommend, if you want/need to use the Config path to
access these, is to dump out the config paths into a text file and then
read through that text file to find the paths you are interested in.

The example program src/config-store/examples/config-store-save.cc shows
an example of how to do this.

First, include this header:

#include "ns3/config-store-module.h"

then, right before you call Simulator::Run(), insert these statements:

// Output config store to txt format
Config::SetDefault ("ns3::ConfigStore::Filename", StringValue
("output-attributes.txt"));
Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue
("RawText"));
Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
ConfigStore outputConfig2;
outputConfig2.ConfigureAttributes ();

Then run your program. You will then find a file called
'output-attributes.txt' with all of the available paths that were found
(and hopefully it gives you a clue of the path string to connect to a
child queue disc).

- Tom

Said Ouhmi

unread,
Jun 1, 2021, 3:46:40 AM6/1/21
to ns-3-users

Hi Teacher 
I hope you're fine ? I have a code to execute in ns3 (code economy of energy in WSN) but when i execuste it in NS3  i have this erreurs , if you can help me  please because i have this project in may end of stadies .
i will sent to you 2  file 
1: screnn of the errors 
2: code source of the energy.cc
thank you so much teacher 

Vignesh K

unread,
Jun 2, 2021, 5:26:16 AM6/2/21
to ns-3-users
Hello Tom,

Thank you so much for your inputs. It helps a lot. This prints the config paths, from which the desired data can be connected by retrieving an object followed by the parameter.

Here is the example which worked for me (will help for people looking the same in future),

From below config path, I can able to connect to the data I want to trace,

value /$ns3::NodeListPriv/NodeList/0/$ns3::Node/$ns3::TrafficControlLayer/RootQueueDiscList/1/$ns3::PrioQueueDisc/Quota "64"
value /$ns3::NodeListPriv/NodeList/0/$ns3::Node/$ns3::TrafficControlLayer/RootQueueDiscList/1/$ns3::PrioQueueDisc/QueueDiscClassList/0/$ns3::QueueDiscClass/QueueDisc/$ns3::FifoQueueDisc/Quota "64"

/NodeList/0/$ns3::Node/$ns3::TrafficControlLayer/RootQueueDiscList/1/$ns3::PrioQueueDisc/QueueDiscClassList/0/$ns3::QueueDiscClass/QueueDisc/PacketsInQueue
/NodeList/0/$ns3::Node/$ns3::TrafficControlLayer/RootQueueDiscList/1/$ns3::PrioQueueDisc/QueueDiscClassList/0/$ns3::QueueDiscClass/QueueDisc/$ns3::FifoQueueDisc/Enqueue
/NodeList/0/$ns3::Node/$ns3::TrafficControlLayer/RootQueueDiscList/1/$ns3::PrioQueueDisc/QueueDiscClassList/0/$ns3::QueueDiscClass/QueueDisc/$ns3::FifoQueueDisc/Dequeue

Than you so much again, Tom!

Regards,
Vignesh.


NOTE:

If we use the traffic control helper with queue disc of interest, we have to access the index "1" in the RootQueueDiscList - ".../$ns3::TrafficControlLayer/RootQueueDiscList/1/...". And it is not "0", I assume "0" is always for default rootqueuedisc. Pls. correct me here if I'm wrong.
Reply all
Reply to author
Forward
0 new messages