source: tools/tracereport/error_report.c @ d3ff1fb

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

Add trace summary

  • Property mode set to 100644
File size: 564 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 rx_errors = 0;
8static uint64_t ip_errors = 0;
9
10void error_per_packet(struct libtrace_packet_t *packet)
11{
12        struct libtrace_ip *ip = trace_get_ip(packet);
13        void *link = trace_get_link(packet);
14        if (!link) {
15                ++rx_errors;
16        }
17        if (ip) {
18                if (ntohs(ip->ip_sum)!=0)
19                        ++ip_errors;
20        }
21
22}
23
24void error_report(void)
25{
26        printf("# Errors:\n");
27        printf("RX Errors: %" PRIu64 "\n",rx_errors);
28        printf("IP Checksum errors: %" PRIu64 "\n",ip_errors);
29}
Note: See TracBrowser for help on using the repository browser.