Changeset 904c639
- Timestamp:
- 06/12/09 16:19:38 (12 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, 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:
- 8365c66
- Parents:
- 3fc7948
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracereport/tracereport.c
r4423dc7 r904c639 51 51 struct libtrace_t *trace; 52 52 uint32_t reports_required = 0; 53 int packets_read = 0; 53 54 54 55 static volatile int done=0; … … 63 64 { 64 65 struct libtrace_packet_t *packet = trace_create_packet(); 66 67 /* Already read the maximum number of packets - don't need to read 68 * anything from this trace */ 69 if ((count >= 0 && packets_read >= count) || done) 70 return; 65 71 66 72 trace = trace_create(uri); … … 80 86 } 81 87 82 for (;;) {88 while (1) { 83 89 int psize; 84 90 85 /* Not convinced we need this count business */ 86 /* 87 if (count--<1) 91 if (count >= 0 && packets_read >= count) 88 92 break; 89 */90 93 if (done) 91 94 break; … … 119 122 if (reports_required & REPORT_TYPE_TCPSEG) 120 123 tcpseg_per_packet(packet); 124 125 packets_read ++; 121 126 } 122 127 if (reports_required & REPORT_TYPE_DROPS) … … 130 135 "%s flags traceuri [traceuri...]\n" 131 136 "-f --filter=bpf \tApply BPF filter. Can be specified multiple times\n" 137 "-c --count=N Stop after reading N packets\n" 132 138 "-e --error Report packet errors (e.g. checksum failures, rxerrors)\n" 133 139 "-F --flow Report flows\n" … … 154 160 char *filterstring=NULL; 155 161 struct sigaction sigact; 162 int count = -1; 156 163 157 164 libtrace_filter_t *filter = NULL;/*trace_bpf_setfilter(filterstring); */ … … 160 167 int option_index; 161 168 struct option long_options[] = { 169 { "count", 1, 0, 'c' }, 162 170 { "ecn", 0, 0, 'C' }, 163 171 { "direction", 0, 0, 'd' }, … … 178 186 { NULL, 0, 0, 0 } 179 187 }; 180 opt = getopt_long(argc, argv, "Df:HemFPpTtOondCs l:",188 opt = getopt_long(argc, argv, "Df:HemFPpTtOondCsc:", 181 189 long_options, &option_index); 182 190 if (opt == -1) … … 184 192 185 193 switch (opt) { 194 case 'c': 195 count = atoi(optarg); 196 break; 186 197 case 'C': 187 198 reports_required |= REPORT_TYPE_ECN; … … 261 272 * genuine output at the moment */ 262 273 fprintf(stderr, "Reading from trace: %s\n", argv[i]); 263 run_trace(argv[i],filter, (1<<30));274 run_trace(argv[i],filter, count); 264 275 } 265 276
Note: See TracChangeset
for help on using the changeset viewer.