Changeset 5478d3d for tools


Ignore:
Timestamp:
09/15/15 17:16:51 (5 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
8decff7
Parents:
624c2da
Message:

Fix all outstanding warnings

Implemented trace_get_statistics for formats that were missing it, so
we no longer need to use the deprecated trace_get_dropped_packets anywhere
within libtrace.

Location:
tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/tracereport/dir_report.c

    r39aa3c7 r5478d3d  
    1212void dir_per_packet(struct libtrace_packet_t *packet)
    1313{
    14         if (trace_get_direction(packet)==~0U)
     14        if (trace_get_direction(packet)==-1)
    1515                return;
    1616        dir_bytes[trace_get_direction(packet)]+=trace_get_wire_length(packet);
  • tools/tracereport/drops_report.c

    r4423dc7 r5478d3d  
    44#include <time.h>
    55#include <string.h>
     6#include <stdlib.h>
    67#include "libtrace.h"
    78#include "tracereport.h"
     
    2021void drops_per_trace(libtrace_t *trace)
    2122{
    22         uint64_t packets;
     23        libtrace_stat_t *stat;
    2324
    24         packets = trace_get_received_packets(trace);
    25         if (packets != UINT64_MAX) {
    26                 received_packets+=packets;
     25        stat = trace_create_statistics();
     26
     27        trace_get_statistics(trace, stat);
     28
     29        if (stat->received_valid) {
     30                received_packets+=stat->received;
    2731                has_received=true;
    2832        }
    2933
    30         packets = trace_get_filtered_packets(trace);
    31         if (packets != UINT64_MAX) {
    32                 filtered_packets+=packets;
     34        if (stat->filtered_valid) {
     35                filtered_packets+=stat->filtered;
    3336                has_filtered=true;
    3437        }
    3538
    36         packets = trace_get_dropped_packets(trace);
    37         if (packets != UINT64_MAX) {
    38                 dropped_packets+=packets;
     39        if (stat->dropped_valid) {
     40                dropped_packets+=stat->dropped;
    3941                has_dropped=true;
    4042        }
    4143
    42         packets = trace_get_accepted_packets(trace);
    43         if (packets != UINT64_MAX) {
    44                 accepted_packets+=packets;
     44        if (stat->accepted_valid) {
     45                accepted_packets+=stat->accepted;
    4546                has_accepted=true;
    4647        }
     48        free(stat);
    4749}
    4850
  • tools/tracesplit/tracesplit.c

    r17f954f r5478d3d  
    8282static int per_packet(libtrace_packet_t *packet) {
    8383
    84         if (trace_get_link_type(packet) == ~0U) {
     84        if (trace_get_link_type(packet) == -1) {
    8585                fprintf(stderr, "Halted due to being unable to determine linktype - input trace may be corrupt.\n");
    8686                return -1;
     
    387387
    388388        if (verbose) {
    389                 uint64_t f;
    390                 f=trace_get_received_packets(input);
    391                 if (f!=UINT64_MAX)
    392                         fprintf(stderr,"%" PRIu64 " packets on input\n",f);
    393                 f=trace_get_filtered_packets(input);
    394                 if (f!=UINT64_MAX)
    395                         fprintf(stderr,"%" PRIu64 " packets filtered\n",f);
    396                 f=trace_get_dropped_packets(input);
    397                 if (f!=UINT64_MAX)
    398                         fprintf(stderr,"%" PRIu64 " packets dropped\n",f);
    399                 f=trace_get_accepted_packets(input);
    400                 if (f!=UINT64_MAX)
    401                         fprintf(stderr,"%" PRIu64 " packets accepted\n",f);
    402         }
     389                libtrace_stat_t *stat;
     390               
     391                stat = trace_create_statistics();
     392                trace_get_statistics(input, stat);
     393
     394                if (stat->received_valid)
     395                        fprintf(stderr,"%" PRIu64 " packets on input\n",
     396                                        stat->received);
     397                if (stat->filtered_valid)
     398                        fprintf(stderr,"%" PRIu64 " packets filtered\n",
     399                                        stat->filtered);
     400                if (stat->dropped_valid)
     401                        fprintf(stderr,"%" PRIu64 " packets dropped\n",
     402                                        stat->dropped);
     403                if (stat->accepted_valid)
     404                        fprintf(stderr,"%" PRIu64 " packets accepted\n",
     405                                        stat->accepted);
     406                free(stat);
     407        }
    403408       
    404409        if (output)
Note: See TracChangeset for help on using the changeset viewer.