Changeset 5ab626a for tools/tracestats
- Timestamp:
- 02/18/15 17:41:48 (6 years ago)
- 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:
- e4f27d1
- Parents:
- 8bcc925
- Location:
- tools/tracestats
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracestats/tracestats.c
r3c54095 r5ab626a 84 84 uint64_t count = 0; 85 85 uint64_t bytes = 0; 86 uint64_t packets;86 libtrace_stat_t *stats; 87 87 88 88 fprintf(stderr,"%s:\n",uri); … … 128 128 ++count; 129 129 bytes+=wlen; 130 } 130 } 131 132 stats = trace_get_statistics(trace, NULL); 131 133 132 134 printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","%"); … … 136 138 filters[i].count=0; 137 139 } 138 packets=trace_get_received_packets(trace); 139 if (packets!=UINT64_MAX) 140 if (stats->received_valid) 140 141 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 141 "Input packets", packets); 142 packets=trace_get_filtered_packets(trace); 143 if (packets!=UINT64_MAX) 142 "Input packets", stats->received); 143 if (stats->filtered_valid) 144 144 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 145 "Filtered packets", packets); 146 packets=trace_get_dropped_packets(trace); 147 if (packets!=UINT64_MAX) 145 "Filtered packets", stats->filtered); 146 if (stats->dropped_valid) 148 147 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 149 "Dropped packets",packets); 150 packets=trace_get_accepted_packets(trace); 151 if (packets!=UINT64_MAX) 148 "Dropped packets",stats->dropped); 149 if (stats->accepted_valid) 152 150 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 153 "Accepted Packets",packets); 151 "Accepted packets", stats->accepted); 152 if (stats->errors_valid) 153 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 154 "Erred packets", stats->errors); 154 155 printf("%30s:\t%12"PRIu64"\t%12" PRIu64 "\n","Total",count,bytes); 155 156 totcount+=count; -
tools/tracestats/tracestats_parallel.c
rd994324 r5ab626a 132 132 case MESSAGE_STOPPING: 133 133 trace_publish_result(trace, t, 0, (libtrace_generic_types_t){.ptr = results}, RESULT_NORMAL); // Only ever using a single key 0 134 fprintf(stderr, "Thread published resuslts WOWW\n");134 //fprintf(stderr, "tracestats_parallel:\t Stopping thread - publishing results\n"); 135 135 break; 136 136 case MESSAGE_STARTING: … … 138 138 break; 139 139 case MESSAGE_DO_PAUSE: 140 fprintf(stderr, "GOT Asked to pause ahh\n");140 assert(!"GOT Asked to pause!!!\n"); 141 141 break; 142 142 case MESSAGE_PAUSING: 143 fprintf(stderr, "Thread is pausing\n");143 //fprintf(stderr, "tracestats_parallel:\t pausing thread\n"); 144 144 break; 145 145 case MESSAGE_RESUMING: 146 fprintf(stderr, "Thread has paused\n");146 //fprintf(stderr, "tracestats_parallel:\t resuming thread\n"); 147 147 break; 148 148 } … … 168 168 free(res); 169 169 } else switch (mesg->code) { 170 libtrace_stat_t *stats; 170 171 case MESSAGE_STOPPING: 172 stats = trace_get_statistics(trace, NULL); 171 173 printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","%"); 172 174 for(i=0;i<filter_count;++i) { … … 175 177 filters[i].count=0; 176 178 } 177 packets=trace_get_received_packets(trace); 178 if (packets!=UINT64_MAX) 179 if (stats->received_valid) 179 180 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 180 "Input packets", packets); 181 packets=trace_get_filtered_packets(trace); 182 if (packets!=UINT64_MAX) 181 "Input packets", stats->received); 182 if (stats->filtered_valid) 183 183 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 184 "Filtered packets", packets); 185 packets=trace_get_dropped_packets(trace); 186 if (packets!=UINT64_MAX) 184 "Filtered packets", stats->filtered); 185 if (stats->dropped_valid) 187 186 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 188 "Dropped packets",packets); 189 packets=trace_get_accepted_packets(trace); 190 if (packets!=UINT64_MAX) 187 "Dropped packets",stats->dropped); 188 if (stats->accepted_valid) 191 189 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 192 "Accepted Packets",packets); 190 "Accepted packets", stats->accepted); 191 if (stats->errors_valid) 192 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 193 "Erred packets", stats->errors); 193 194 printf("%30s:\t%12"PRIu64"\t%12" PRIu64 "\n","Total",count,bytes); 194 195 totcount+=count;
Note: See TracChangeset
for help on using the changeset viewer.