[Coral-dev] Printing packet stats: 0 packets received?

Srinivas Krishnan krishnan at cs.unc.edu
Tue Jul 6 10:00:56 PDT 2010


Jeff,

I use coral_read_pkts (instead of read_pkt) and pass in a callback, which
gets called at `interval' 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.

Something like this:
  coral_read_pkts(NULL, NULL, &process_pkt_handler, NULL, print_pkt_stats,
                  &default_interval, stats);

To the handler I pass in a stats struct,  Though, I think the
post_interval_handler receives the  const
coral_pkt_stats_t<http://www.caida.org/tools/measurement/coralreef/doc/doc/libcoral-c.html#coral_pkt_stats_t>*stats,
which has drops, received etc as well.

-srinivas


On Tue, Jul 6, 2010 at 8:48 AM, Jeff Terrell <jeff.terrell at acm.org> wrote:

> Hello,
>
> I'd like to periodically print the number of packets that CoralReef
> has dropped and the number it has received.  The interval
> functionality seems to be a great mechanism for this.  However, I
> think the statistics it is reporting to me are incorrect.
>
> I wrote a minimal example program to demonstrate my problem, which you
> can see here:
>
> http://pastebin.com/aAZng31y
>
> I'm reading packets from a 32-second pcap trace.  My program receives
> a packet from coral_read_pkt() a total of 4,203,253 times, which is
> the same as the number of packets reported by `tcpdump -nnr`.
> However, the stats->pkts_recv counter (and every other counter) is 0,
> both when the statistics are part of the interval received from
> coral_read_pkt() as well as when the statistics are are received from
> coral_get_interface_stats() at the end of the program.  The output of
> the program on my pcap trace can be seen here:
>
> http://pastebin.com/EXqe83G4
>
> Am I misunderstanding the purpose of the pkts_recv counter?  Or am I
> not using it correctly?  Or is it really broken?  Please help.
>
> I'm running CoralReef version 3.8.6-public and libpcap version 1.0.0
> on a (Linode) Ubuntu Linux v2.6.32.12-x86_64 system.
>
> Thanks,
> -Jeff T.
>
> _______________________________________________
> Coral-dev mailing list
> Coral-dev at caida.org
> https://rommie.caida.org/mailman/listinfo/coral-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rommie.caida.org/pipermail/coral-dev/attachments/20100706/07eb039f/attachment.htm


More information about the Coral-dev mailing list