Changeset 02d13cb
- Timestamp:
- 03/01/18 17:10:50 (3 years ago)
- Branches:
- cachetimestamps, develop, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- 43b773a
- Parents:
- 207e288
- Location:
- tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracertstats/tracertstats.c
ra8cfe71 r02d13cb 197 197 thread_data_t *td = (thread_data_t *)tls; 198 198 int i; 199 size_t wlen; 199 200 200 201 if (IS_LIBTRACE_META_PACKET(packet)) { … … 212 213 sizeof(statistic_t) * filter_count); 213 214 } 215 wlen = trace_get_wire_length(packet); 216 if (wlen == 0) { 217 /* Don't count ERF provenance and similar packets */ 218 return packet; 219 } 214 220 for(i=0;i<filter_count;++i) { 215 221 if(trace_apply_filter(filters[i].filter, packet)) { 216 222 td->results->filters[i].count++; 217 td->results->filters[i].bytes+= trace_get_wire_length(packet);223 td->results->filters[i].bytes+=wlen; 218 224 } 219 225 } 220 226 221 227 td->results->total.count++; 222 td->results->total.bytes += trace_get_wire_length(packet);228 td->results->total.bytes += wlen; 223 229 return packet; 224 230 } -
tools/tracestats/tracestats.c
r8e11beb r02d13cb 105 105 libtrace_stat_t *stats = NULL; 106 106 int i; 107 double pct; 107 108 108 109 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"); 110 111 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); 112 118 } 113 119 if (stats->received_valid) … … 160 166 /* Apply filters to every packet note the result */ 161 167 wlen = trace_get_wire_length(pkt); 168 if (wlen == 0) { 169 /* Don't count ERF provenance etc. */ 170 return pkt; 171 } 162 172 for(i=0;i<filter_count;++i) { 163 173 if (filters[i].filter == NULL)
Note: See TracChangeset
for help on using the changeset viewer.