<div dir="ltr"><div>Hi all,</div><div><br></div><div>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?</div><div><br></div><div>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?<br></div><div><br></div><div><span style="font-family:monospace">int num_drops = 0;<br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">void Strategy::OnDroppedPacket(...) {</span></div><div><span style="font-family:monospace">  num_drops += 1;</span></div><div><span style="font-family:monospace">  //...<br></span></div><div><span style="font-family:monospace">}</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">void Strategy::everyNSeconds() {</span></div><div><span style="font-family:monospace">  //...<br></span></div><div><span style="font-family:monospace">  std::cout << num_drops;<br></span></div><div><span style="font-family:monospace">  num_drops = 0;</span></div><div><span style="font-family:monospace">  //...<br></span></div><div><span style="font-family:monospace">}</span><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Eric Binnendyk<br></div></div>