Ignore:
Timestamp:
03/01/18 17:10:50 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
43b773a
Parents:
207e288
Message:

Don't count ERF provenance records during tracestats, tracertstats

Or any other records with 0 wire length for that matter.

This was especially off-putting when using filters as provenance
records automatically match all filters, so you could get some
very misleading results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/tracestats/tracestats.c

    r8e11beb r02d13cb  
    105105        libtrace_stat_t *stats = NULL;
    106106        int i;
     107        double pct;
    107108
    108109        stats = trace_get_statistics(trace, NULL);
    109         printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","%");
     110        printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","% count");
    110111        for(i=0;i<filter_count;++i) {
    111                 printf("%30s:\t%12"PRIu64"\t%12"PRIu64"\t%7.03f\n",filters[i].expr,counters[i+1].count,counters[i+1].bytes,counters[i+1].count*100.0/counters[0].count);
     112                if (counters[0].count == 0) {
     113                        pct = 0.0;
     114                } else {
     115                        pct = counters[i+1].count*100.0/counters[0].count;
     116                }
     117                printf("%30s:\t%12"PRIu64"\t%12"PRIu64"\t%7.03f\n",filters[i].expr,counters[i+1].count,counters[i+1].bytes,pct);
    112118        }
    113119        if (stats->received_valid)
     
    160166        /* Apply filters to every packet note the result */
    161167        wlen = trace_get_wire_length(pkt);
     168        if (wlen == 0) {
     169                /* Don't count ERF provenance etc. */
     170                return pkt;
     171        }
    162172        for(i=0;i<filter_count;++i) {
    163173                if (filters[i].filter == NULL)
Note: See TracChangeset for help on using the changeset viewer.