Changeset 6b98325 for tools/tracestats
- Timestamp:
- 03/23/15 17:52:17 (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:
- 773d5e2
- Parents:
- 963b13b
- Location:
- tools/tracestats
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracestats/tracestats.c
r5ab626a r6b98325 129 129 bytes+=wlen; 130 130 } 131 trace_destroy_packet(packet); 131 132 132 133 stats = trace_get_statistics(trace, NULL); -
tools/tracestats/tracestats_parallel.c
r6a6e6a8 r6b98325 215 215 } 216 216 217 struct user_configuration uc;218 219 220 217 /* Process a trace, counting packets that match filter(s) */ 221 static void run_trace(char *uri )218 static void run_trace(char *uri, char *config, char *config_file) 222 219 { 223 220 … … 230 227 return; 231 228 } 232 233 int option = 2; 229 230 //libtrace_filter_t *f = trace_create_filter("udp"); 231 //trace_config(trace, TRACE_OPTION_FILTER, f); 232 233 //trace_config(trace, TRACE_OPTION_META_FREQ, &option); 234 234 //option = 10000; 235 //trace_set_hasher(trace, HASHER_CUSTOM, &rand_hash, NULL);235 trace_set_hasher(trace, HASHER_CUSTOM, &rand_hash, NULL); 236 236 //trace_parallel_config(trace, TRACE_OPTION_SET_PERPKT_THREAD_COUNT, &option); 237 trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc); 237 238 /* Apply config */ 239 if (config) { 240 trace_set_configuration(trace, config); 241 } 242 243 if (config_file) { 244 FILE * f = fopen(optarg, "r"); 245 if (f != NULL) { 246 trace_set_configuration_file(trace, f); 247 fclose(f); 248 } else { 249 perror("Failed to open configuration file\n"); 250 exit(-1); 251 } 252 } 253 238 254 trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t){0}); 239 255 … … 278 294 int i; 279 295 struct sigaction sigact; 280 ZERO_USER_CONFIG(uc); 296 char *config = NULL; 297 char *config_file = NULL; 298 281 299 while(1) { 282 300 int option_index; … … 309 327 break; 310 328 case 'u': 311 parse_user_config(&uc, optarg); 312 break; 313 case 'U':; 314 FILE * f = fopen(optarg, "r"); 315 if (f != NULL) { 316 parse_user_config_file(&uc, f); 317 } else { 318 perror("Failed to open configuration file\n"); 319 usage(argv[0]); 320 } 329 config = optarg; 330 break; 331 case 'U': 332 config_file = optarg; 321 333 break; 322 334 default: … … 333 345 sigaction(SIGINT, &sigact, NULL); 334 346 sigaction(SIGTERM, &sigact, NULL); 335 347 336 348 for(i=optind;i<argc;++i) { 337 run_trace(argv[i] );349 run_trace(argv[i], config, config_file); 338 350 } 339 351 if (optind+1<argc) {
Note: See TracChangeset
for help on using the changeset viewer.