<div>Jeff,</div>
<div> </div>
<div>I use coral_read_pkts (instead of read_pkt) and pass in a callback, which gets called at `interval&#39; seconds to print out stats. In the past I have had issue with read_pkt where the struct would get zeroed out when I tried to read it at interval seconds. Using the callback, forces the library to call the handler and break out of the processing loop.</div>

<div> </div>
<div>Something like this:</div>
<div>  coral_read_pkts(NULL, NULL, &amp;process_pkt_handler, NULL, print_pkt_stats,<br>                  &amp;default_interval, stats);</div>
<div> </div>
<div>To the handler I pass in a stats struct,  Though, I think the post_interval_handler receives the <font size="4" face="Courier New"> const </font><a href="http://www.caida.org/tools/measurement/coralreef/doc/doc/libcoral-c.html#coral_pkt_stats_t"><font size="4" face="Courier New">coral_pkt_stats_t</font></a><font size="4" face="Courier New"> *stats,</font></div>

<div>which has drops, received etc as well.</div>
<div> </div>
<div>-srinivas<br><br><br></div>
<div class="gmail_quote">On Tue, Jul 6, 2010 at 8:48 AM, Jeff Terrell <span dir="ltr">&lt;<a href="mailto:jeff.terrell@acm.org">jeff.terrell@acm.org</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hello,<br><br>I&#39;d like to periodically print the number of packets that CoralReef<br>has dropped and the number it has received.  The interval<br>
functionality seems to be a great mechanism for this.  However, I<br>think the statistics it is reporting to me are incorrect.<br><br>I wrote a minimal example program to demonstrate my problem, which you<br>can see here:<br>
<br><a href="http://pastebin.com/aAZng31y" target="_blank">http://pastebin.com/aAZng31y</a><br><br>I&#39;m reading packets from a 32-second pcap trace.  My program receives<br>a packet from coral_read_pkt() a total of 4,203,253 times, which is<br>
the same as the number of packets reported by `tcpdump -nnr`.<br>However, the stats-&gt;pkts_recv counter (and every other counter) is 0,<br>both when the statistics are part of the interval received from<br>coral_read_pkt() as well as when the statistics are are received from<br>
coral_get_interface_stats() at the end of the program.  The output of<br>the program on my pcap trace can be seen here:<br><br><a href="http://pastebin.com/EXqe83G4" target="_blank">http://pastebin.com/EXqe83G4</a><br><br>
Am I misunderstanding the purpose of the pkts_recv counter?  Or am I<br>not using it correctly?  Or is it really broken?  Please help.<br><br>I&#39;m running CoralReef version 3.8.6-public and libpcap version 1.0.0<br>on a (Linode) Ubuntu Linux v2.6.32.12-x86_64 system.<br>
<br>Thanks,<br>-Jeff T.<br><br>_______________________________________________<br>Coral-dev mailing list<br><a href="mailto:Coral-dev@caida.org">Coral-dev@caida.org</a><br><a href="https://rommie.caida.org/mailman/listinfo/coral-dev" target="_blank">https://rommie.caida.org/mailman/listinfo/coral-dev</a><br>
</blockquote></div><br>