4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 2553732 was
e3b0188,
checked in by Daniel Lawson <dlawson@…>, 17 years ago
|
a lot of changes for cross-compilation support
- header ordering
- os-specific headers
- an lt_inttypes.h which defines PRIu64 etc for platforms that don't have them
- removed daglegacy.h, merged with dagformat.h
|
-
Property mode set to
100644
|
File size:
688 bytes
|
Rev | Line | |
---|
[d3ff1fb] | 1 | #include <netdb.h> |
---|
| 2 | #include <inttypes.h> |
---|
[e3b0188] | 3 | #include <lt_inttypes.h> |
---|
[d3ff1fb] | 4 | #include <stdio.h> |
---|
| 5 | #include "libtrace.h" |
---|
| 6 | #include "tracereport.h" |
---|
| 7 | |
---|
| 8 | static stat_t ttl_stat[256] = { {0,0} } ; |
---|
| 9 | |
---|
| 10 | void ttl_per_packet(struct libtrace_packet_t *packet) |
---|
| 11 | { |
---|
| 12 | struct libtrace_ip *ip = trace_get_ip(packet); |
---|
| 13 | if (!ip) |
---|
| 14 | return; |
---|
| 15 | |
---|
| 16 | ttl_stat[ip->ip_ttl].count++; |
---|
| 17 | ttl_stat[ip->ip_ttl].bytes+=trace_get_wire_length(packet); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | void ttl_report(void) |
---|
| 21 | { |
---|
| 22 | int i; |
---|
| 23 | printf("# TTL breakdown:\n"); |
---|
| 24 | printf("%-20s \t%12s\t%12s\n","TTL","bytes","packets"); |
---|
| 25 | for(i=0;i<256;++i) { |
---|
| 26 | if (ttl_stat[i].count==0) |
---|
| 27 | continue; |
---|
| 28 | printf("%20i:\t%12" PRIu64 ":\t%12" PRIu64 "\n", |
---|
| 29 | i, |
---|
| 30 | ttl_stat[i].bytes, |
---|
| 31 | ttl_stat[i].count); |
---|
| 32 | } |
---|
| 33 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.