[Coral-dev] Printing packet stats: 0 packets received?
Jeff Terrell
jeff.terrell at acm.org
Tue Jul 6 12:33:09 PDT 2010
On Tue, Jul 6, 2010 at 1:00 PM, Srinivas Krishnan <krishnan at cs.unc.edu> wrote:
>> 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 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 *stats,
> which has drops, received etc as well.
>
> -srinivas
Good suggestion--thanks, Srinivas!
I changed my little example program to use the coral_read_pkts()
callback-based interface, and I still have the same problem. My
packet-handling callback is getting called the correct number of
times, but all of the stats counters are still 0. My revised program
is here:
http://pastebin.com/8AQnKG6Y
So, I'm still at a loss here. Any other ideas?
Thanks,
-Jeff T.
More information about the Coral-dev
mailing list