Changeset 5b4d121 for tools/traceanon/traceanon_parallel.c
- Timestamp:
- 08/19/14 13:59:33 (7 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:
- f0e8bd6
- Parents:
- 957a72a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/traceanon/traceanon_parallel.c
rf051c1b r5b4d121 198 198 case MESSAGE_STARTING: 199 199 enc_init(enc_type,key); 200 break; 201 case MESSAGE_TICK: 202 trace_publish_result(trace, t, mesg->additional.uint64, NULL, RESULT_TICK); 200 203 } 201 204 } … … 207 210 static void* write_out(libtrace_t *trace, libtrace_result_t *result, UNUSED libtrace_message_t *mesg) { 208 211 static uint64_t packet_count = 0; // TESTING PURPOSES, this is not going to work with a live format 212 209 213 if (result) { 210 libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(result); 211 assert(libtrace_result_get_key(result) == packet_count++); 212 if (trace_write_packet(writer,packet)==-1) { 213 trace_perror_output(writer,"writer"); 214 trace_interrupt(); 215 } 216 trace_free_result_packet(trace, packet); 214 if (result->type == RESULT_PACKET) { 215 libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(result); 216 assert(libtrace_result_get_key(result) == packet_count++); 217 if (trace_write_packet(writer,packet)==-1) { 218 trace_perror_output(writer,"writer"); 219 trace_interrupt(); 220 } 221 trace_free_result_packet(trace, packet); 222 223 } else { 224 assert(result->type == RESULT_TICK); 225 // Ignore it 226 } 217 227 } 218 228 return NULL; … … 228 238 char *compress_type_str=NULL; 229 239 trace_option_compresstype_t compress_type = TRACE_OPTION_COMPRESSTYPE_NONE; 230 240 struct user_configuration uc; 241 ZERO_USER_CONFIG(uc); 231 242 232 243 if (argc<2) … … 244 255 { "compress-type", 1, 0, 'Z' }, 245 256 { "libtrace-help", 0, 0, 'H' }, 257 { "config", 1, 0, 'u' }, 258 { "config-file", 1, 0, 'U' }, 246 259 { NULL, 0, 0, 0 }, 247 260 }; 248 261 249 int c=getopt_long(argc, argv, "Z:z:sc:f:dp:H ",262 int c=getopt_long(argc, argv, "Z:z:sc:f:dp:Hu:U:", 250 263 long_options, &option_index); 251 264 … … 297 310 exit(1); 298 311 break; 312 case 'u': 313 parse_user_config(&uc, optarg); 314 break; 315 case 'U':; 316 FILE * f = fopen(optarg, "r"); 317 if (f != NULL) { 318 parse_user_config_file(&uc, f); 319 } else { 320 perror("Failed to open configuration file\n"); 321 usage(argv[0]); 322 } 323 break; 299 324 default: 300 325 fprintf(stderr,"unknown option: %c\n",c); … … 391 416 392 417 int i = 1; 393 trace_parallel_config(trace, TRACE_OPTION_ SEQUENTIAL, &i);418 trace_parallel_config(trace, TRACE_OPTION_ORDERED, &i); 394 419 //trace_parallel_config(trace, TRACE_OPTION_SET_PERPKT_BUFFER_SIZE, &i); 395 i = 2;420 i = 6; 396 421 trace_parallel_config(trace, TRACE_OPTION_SET_PERPKT_THREAD_COUNT, &i); 422 trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc); 423 trace_set_hasher(trace, HASHER_CUSTOM, bad_hash, NULL); 397 424 398 425 if (trace_pstart(trace, NULL, &per_packet, &write_out)==-1) {
Note: See TracChangeset
for help on using the changeset viewer.