source: tools/tracereport/tos_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: 723 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 tos_stat[256] = { {0,0} } ;
10
11void tos_per_packet(struct libtrace_packet_t *packet)
12{
13        struct libtrace_ip *ip = trace_get_ip(packet);
14        if (!ip)
15                return;
16
17        tos_stat[ip->ip_tos].count++;
18        tos_stat[ip->ip_tos].bytes+=trace_get_wire_length(packet);
19}
20
21void tos_report(void)
22{
23        int i;
24        printf("# TOS breakdown:\n");
25        printf("%-20s \t%12s\t%12s\n","ToS","bytes","packets");
26        for(i=0;i<256;++i) {
27                if (tos_stat[i].count==0)
28                        continue;
29                printf("%16s0x%02x:\t%12" PRIu64 ":\t%12" PRIu64 "\n",
30                                " ",
31                                i,
32                                tos_stat[i].bytes,
33                                tos_stat[i].count);
34        }
35}
Note: See TracBrowser for help on using the repository browser.