[ndnSIM] How to calculate number of dropped packets as a variable in code

Eric Binnendyk eric.binnendyk at student.nmt.edu
Thu Jan 6 19:05:33 PST 2022


Hi all,

I'm writing a forwarding strategy in which the queue management system
takes different actions depending on the number of packets dropped per
second on a router node. How can I use a variable in my forwarding strategy
to track the number of dropped packets?

I know that I can use L2Tracer to trace packet drop to a file. I don't know
if this will work for my purposes because I need to recheck the drop rate
every second, and I don't know if the file updates on disk within that
time. My idea was to write something like the code shown below. Is there
any way I can get this to work?

int num_drops = 0;

void Strategy::OnDroppedPacket(...) {
  num_drops += 1;
  //...
}

void Strategy::everyNSeconds() {
  //...
  std::cout << num_drops;
  num_drops = 0;
  //...
}

Thanks,

Eric Binnendyk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20220106/16b4dca4/attachment.html>


More information about the ndnSIM mailing list