source: tools/tracereport/ttl_report.c @ 41816bf

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 41816bf was a7282fb, checked in by Perry Lorier <perry@…>, 15 years ago

Fix lots of little warnings

  • Property mode set to 100644
File size: 708 bytes
RevLine 
[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"
[a7282fb]7#include "report.h"
[d3ff1fb]8
9static stat_t ttl_stat[256] = { {0,0} } ;
10
11void 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
21void 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.