source: tools/tracereport/dir_report.c @ 49ce177

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

Added:

  • error reports
  • flow reports
  • per port reports
  • direction report
  • moved everything to use the container library
  • Property mode set to 100644
File size: 876 bytes
Line 
1#include <netdb.h>
2#include <inttypes.h>
3#include <stdio.h>
4#include "libtrace.h"
5#include "tracereport.h"
6
7static uint64_t dir_bytes[8];
8static uint64_t dir_packets[8];
9
10void dir_per_packet(struct libtrace_packet_t *packet)
11{
12        dir_bytes[trace_get_direction(packet)]+=trace_get_wire_length(packet);
13        ++dir_packets[trace_get_direction(packet)];
14}
15
16void dir_report(void)
17{
18        int i;
19        printf("# Direction\n");
20        printf("%-20s \t%12s\t%12s\n","Direction","bytes","packets");
21        for(i=0;i<8;++i) {
22                if (!dir_packets[i])
23                        continue;
24                switch(i) {
25                        case 0: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n",
26                                        "in",dir_bytes[i],dir_packets[i]);
27                                break;
28                        case 1: printf("%20s:\t%12" PRIu64 "\t%12" PRIu64 "\n",
29                                        "out",dir_bytes[i],dir_packets[i]);
30                                break;
31                        default: printf("%20i:\t%12" PRIu64 "\t%12" PRIu64 "\n",
32                                        i,dir_bytes[i],dir_packets[i]);
33                                break;
34                }
35        }
36}
Note: See TracBrowser for help on using the repository browser.