4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 2595c4d was
a7282fb,
checked in by Perry Lorier <perry@…>, 16 years ago
|
Fix lots of little warnings
|
-
Property mode set to
100644
|
File size:
708 bytes
|
Line | |
---|
1 | #include <netdb.h> |
---|
2 | #include <inttypes.h> |
---|
3 | #include <lt_inttypes.h> |
---|
4 | #include <stdio.h> |
---|
5 | #include "libtrace.h" |
---|
6 | #include "tracereport.h" |
---|
7 | #include "report.h" |
---|
8 | |
---|
9 | static stat_t ttl_stat[256] = { {0,0} } ; |
---|
10 | |
---|
11 | void ttl_per_packet(struct libtrace_packet_t *packet) |
---|
12 | { |
---|
13 | struct libtrace_ip *ip = trace_get_ip(packet); |
---|
14 | if (!ip) |
---|
15 | return; |
---|
16 | |
---|
17 | ttl_stat[ip->ip_ttl].count++; |
---|
18 | ttl_stat[ip->ip_ttl].bytes+=trace_get_wire_length(packet); |
---|
19 | } |
---|
20 | |
---|
21 | void ttl_report(void) |
---|
22 | { |
---|
23 | int i; |
---|
24 | printf("# TTL breakdown:\n"); |
---|
25 | printf("%-20s \t%12s\t%12s\n","TTL","bytes","packets"); |
---|
26 | for(i=0;i<256;++i) { |
---|
27 | if (ttl_stat[i].count==0) |
---|
28 | continue; |
---|
29 | printf("%20i:\t%12" PRIu64 ":\t%12" PRIu64 "\n", |
---|
30 | i, |
---|
31 | ttl_stat[i].bytes, |
---|
32 | ttl_stat[i].count); |
---|
33 | } |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.