- Timestamp:
- 03/05/15 15:44:30 (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:
- ab3fa18
- Parents:
- b023181
- Location:
- tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/traceanon/traceanon_parallel.c
r0ec8a7c r62b3c4e 208 208 struct libtrace_out_t *writer = 0; 209 209 210 static void write_out(libtrace_t *trace, libtrace_result_t *result, UNUSED libtrace_message_t *mesg) { 210 static void write_out(libtrace_t *trace UNUSED, int mesg, 211 libtrace_generic_t data, 212 libtrace_thread_t *sender UNUSED) { 211 213 static uint64_t packet_count = 0; // TESTING PURPOSES, this is not going to work with a live format 212 214 213 if (result) { 214 if (result->type == RESULT_PACKET) { 215 libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(result).pkt; 216 assert(libtrace_result_get_key(result) == packet_count++); 215 switch (mesg) { 216 case MESSAGE_RESULT: 217 if (data.res->type == RESULT_PACKET) { 218 libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(data.res).pkt; 219 assert(libtrace_result_get_key(data.res) == packet_count++); 217 220 if (trace_write_packet(writer,packet)==-1) { 218 221 trace_perror_output(writer,"writer"); … … 222 225 223 226 } else { 224 assert( result->type == RESULT_TICK);227 assert(data.res->type == RESULT_TICK); 225 228 // Ignore it 226 229 } -
tools/tracertstats/tracertstats_parallel.c
rb023181 r62b3c4e 138 138 139 139 static uint64_t last_ts = 0; 140 static void process_result(libtrace_t *trace UNUSED, libtrace_result_t *result, libtrace_message_t *mesg UNUSED) { 140 static void process_result(libtrace_t *trace UNUSED, int mesg, 141 libtrace_generic_t data, 142 libtrace_thread_t *sender UNUSED) { 141 143 static uint64_t ts = 0; 142 143 if (result) { 144 int j; 145 result_t *res; 146 ts = libtrace_result_get_key(result); 147 res = libtrace_result_get_value(result).ptr; 144 int j; 145 result_t *res; 146 147 switch (mesg) { 148 case MESSAGE_RESULT: 149 ts = libtrace_result_get_key(data.res); 150 res = libtrace_result_get_value(data.res).ptr; 148 151 if (last_ts == 0) 149 152 last_ts = ts; … … 274 277 return; 275 278 276 279 trace = trace_create(uri); 277 280 if (trace_is_err(trace)) { 278 281 trace_perror(trace,"trace_create"); … … 291 294 }*/ 292 295 int i = 1; 293 trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t ypes_t){0});296 trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t){0}); 294 297 /* trace_parallel_config(trace, TRACE_OPTION_TRACETIME, &i); */ 295 298 //trace_set_hasher(trace, HASHER_CUSTOM, &bad_hash, NULL); -
tools/tracestats/tracestats_parallel.c
r0ec8a7c r62b3c4e 105 105 static void* per_packet(libtrace_t *trace, libtrace_thread_t *t, 106 106 int mesg, libtrace_generic_t data, 107 libtrace_thread_t *sender )107 libtrace_thread_t *sender UNUSED) 108 108 { 109 109 // Using first entry as total and those after for filter counts … … 158 158 } 159 159 160 static void report_result(libtrace_t *trace UNUSED, libtrace_result_t *result, libtrace_message_t *mesg) { 160 static void report_result(libtrace_t *trace UNUSED, int mesg, 161 libtrace_generic_t data, 162 libtrace_thread_t *sender UNUSED) { 161 163 static uint64_t count=0, bytes=0; 162 uint64_t packets;163 164 int i; 164 if (result) { 165 int j; 165 libtrace_stat_t *stats; 166 167 switch (mesg) { 168 case MESSAGE_RESULT: 166 169 /* Get the results from each core and sum 'em up */ 167 assert(libtrace_result_get_key( result) == 0);168 statistics_t * res = libtrace_result_get_value( result).ptr;170 assert(libtrace_result_get_key(data.res) == 0); 171 statistics_t * res = libtrace_result_get_value(data.res).ptr; 169 172 count += res[0].count; 170 173 bytes += res[0].bytes; 171 for ( j = 0; j < filter_count; j++) {172 filters[ j].count += res[j+1].count;173 filters[ j].bytes += res[j+1].bytes;174 for (i = 0; i < filter_count; i++) { 175 filters[i].count += res[i+1].count; 176 filters[i].bytes += res[i+1].bytes; 174 177 } 175 178 free(res); 176 } else switch (mesg->code) { 177 libtrace_stat_t *stats; 178 case MESSAGE_STOPPING: 179 stats = trace_get_statistics(trace, NULL); 180 printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","%"); 181 for(i=0;i<filter_count;++i) { 182 printf("%30s:\t%12"PRIu64"\t%12"PRIu64"\t%7.03f\n",filters[i].expr,filters[i].count,filters[i].bytes,filters[i].count*100.0/count); 183 filters[i].bytes=0; 184 filters[i].count=0; 185 } 186 if (stats->received_valid) 187 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 188 "Input packets", stats->received); 189 if (stats->filtered_valid) 190 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 191 "Filtered packets", stats->filtered); 192 if (stats->dropped_valid) 193 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 194 "Dropped packets",stats->dropped); 195 if (stats->accepted_valid) 196 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 197 "Accepted packets", stats->accepted); 198 if (stats->errors_valid) 199 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 200 "Erred packets", stats->errors); 201 printf("%30s:\t%12"PRIu64"\t%12" PRIu64 "\n","Total",count,bytes); 202 totcount+=count; 203 totbytes+=bytes; 204 } 205 } 206 207 static uint64_t rand_hash(libtrace_packet_t * pkt, void *data) { 179 break; 180 case MESSAGE_STOPPING: 181 stats = trace_get_statistics(trace, NULL); 182 printf("%-30s\t%12s\t%12s\t%7s\n","filter","count","bytes","%"); 183 for(i=0;i<filter_count;++i) { 184 printf("%30s:\t%12"PRIu64"\t%12"PRIu64"\t%7.03f\n",filters[i].expr,filters[i].count,filters[i].bytes,filters[i].count*100.0/count); 185 filters[i].bytes=0; 186 filters[i].count=0; 187 } 188 if (stats->received_valid) 189 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 190 "Input packets", stats->received); 191 if (stats->filtered_valid) 192 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 193 "Filtered packets", stats->filtered); 194 if (stats->dropped_valid) 195 fprintf(stderr,"%30s:\t%12" PRIu64"\n", 196 "Dropped packets",stats->dropped); 197 if (stats->accepted_valid) 198 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 199 "Accepted packets", stats->accepted); 200 if (stats->errors_valid) 201 fprintf(stderr,"%30s:\t%12" PRIu64 "\n", 202 "Erred packets", stats->errors); 203 printf("%30s:\t%12"PRIu64"\t%12" PRIu64 "\n","Total",count,bytes); 204 totcount+=count; 205 totbytes+=bytes; 206 } 207 } 208 209 static uint64_t rand_hash(libtrace_packet_t * pkt UNUSED, void *data UNUSED) { 208 210 return rand(); 209 211 } 210 212 211 static uint64_t bad_hash(libtrace_packet_t * pkt , void *data) {213 static uint64_t bad_hash(libtrace_packet_t * pkt UNUSED, void *data UNUSED) { 212 214 return 0; 213 215 } … … 234 236 //trace_parallel_config(trace, TRACE_OPTION_SET_PERPKT_THREAD_COUNT, &option); 235 237 trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc); 236 trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t ypes_t){0});238 trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t){0}); 237 239 238 240 //trace_parallel_config(trace, TRACE_OPTION_SET_MAPPER_BUFFER_SIZE, &option);
Note: See TracChangeset
for help on using the changeset viewer.