source: tools/tracereport/dir_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: 969 bytes
RevLine 
[49ce177]1#include <netdb.h>
2#include <inttypes.h>
[e3b0188]3#include <lt_inttypes.h>
[49ce177]4#include <stdio.h>
5#include "libtrace.h"
6#include "tracereport.h"
[a7282fb]7#include "report.h"
[49ce177]8
9static uint64_t dir_bytes[8];
10static uint64_t dir_packets[8];
11
12void dir_per_packet(struct libtrace_packet_t *packet)
13{
[3b49843]14        if (trace_get_direction(packet)==-1)
15                return;
[49ce177]16        dir_bytes[trace_get_direction(packet)]+=trace_get_wire_length(packet);
17        ++dir_packets[trace_get_direction(packet)];
18}
19
20void dir_report(void)
21{
22        int i;
23        printf("# Direction\n");
24        printf("%-20s \t%12s\t%12s\n","Direction","bytes","packets");
25        for(i=0;i<8;++i) {
26                if (!dir_packets[i])
27                        continue;
28                switch(i) {
29                        case 0: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n",
30                                        "in",dir_bytes[i],dir_packets[i]);
31                                break;
32                        case 1: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n",
33                                        "out",dir_bytes[i],dir_packets[i]);
34                                break;
35                        default: printf("%20i:\t%12" PRIu64 "\t%12" PRIu64 "\n",
36                                        i,dir_bytes[i],dir_packets[i]);
37                                break;
38                }
39        }
40}
Note: See TracBrowser for help on using the repository browser.