how to Monitor the current queue size in a specific node in ns-3 ?

56 Views Asked by At

here is my code :

TrafficControlHelper tchRed10;
  tchRed10.SetRootQueueDisc ("ns3::DropTailQueue", "MaxPackets",UintegerValue(10));
  QueueDiscContainer queueDiscs1 = tchRed10.Install (d0d2);
  Simulator::Schedule (Seconds (1.0), &MonitorQueueSize, queueDiscs1.Get (0));

void
MonitorQueueSize (Ptr<QueueDisc> queue)
{
  uint32_t qSize = queue->GetNPackets ();
  std::cout << "Queue size: " << qSize << std::endl;
  Simulator::Schedule (Seconds (1.0), &MonitorQueueSize, queue); 
}

but didn't work. enter image description here

0

There are 0 best solutions below