- Timestamp:
- 09/11/15 15:00:27 (5 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:
- 322c516
- Parents:
- 8c7490fe
- Location:
- tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracertstats/tracertstats.c
r8c7490fe rf625817 130 130 131 131 static uint64_t glob_last_ts = 0; 132 static void process_result(libtrace_t *trace, int mesg,133 libtrace_generic_t data,134 libtrace_thread_t *sender UNUSED) {132 static void cb_result(libtrace_t *trace, libtrace_thread_t *sender UNUSED, 133 void *global UNUSED, void *tls UNUSED, 134 libtrace_result_t *result) { 135 135 uint64_t ts = 0; 136 136 static bool stopped = false; … … 142 142 return; 143 143 144 switch (mesg) { 145 case MESSAGE_RESULT: 146 ts = data.res->key; 147 res = data.res->value.ptr; 148 if (glob_last_ts == 0) 149 glob_last_ts = ts; 150 while ((glob_last_ts >> 32) < (ts >> 32)) { 151 report_results(glob_last_ts >> 32, count, bytes); 152 count = 0; 153 bytes = 0; 154 for (j = 0; j < filter_count; j++) 155 filters[j].count = filters[j].bytes = 0; 156 glob_last_ts = ts; 157 } 158 count += res->total.count; 159 packets_seen += res->total.count; 160 bytes += res->total.bytes; 161 for (j = 0; j < filter_count; j++) { 162 filters[j].count += res->filters[j].count; 163 filters[j].bytes += res->filters[j].bytes; 164 } 165 free(res); 166 } 144 ts = result->key; 145 res = result->value.ptr; 146 if (glob_last_ts == 0) 147 glob_last_ts = ts; 148 while ((glob_last_ts >> 32) < (ts >> 32)) { 149 report_results(glob_last_ts >> 32, count, bytes); 150 count = 0; 151 bytes = 0; 152 for (j = 0; j < filter_count; j++) 153 filters[j].count = filters[j].bytes = 0; 154 glob_last_ts = ts; 155 } 156 count += res->total.count; 157 packets_seen += res->total.count; 158 bytes += res->total.bytes; 159 for (j = 0; j < filter_count; j++) { 160 filters[j].count += res->filters[j].count; 161 filters[j].bytes += res->filters[j].bytes; 162 } 163 free(res); 167 164 168 165 /* Be careful to only call pstop once from within this thread! */ … … 246 243 { 247 244 libtrace_t *trace = NULL; 248 if (!merge_inputs) 245 libtrace_callback_set_t *pktcbs, *repcbs; 246 247 if (!merge_inputs) 249 248 create_output(uri); 250 249 … … 268 267 } 269 268 270 trace_cb_starting(trace, cb_starting); 271 trace_cb_stopping(trace, cb_stopping); 272 trace_cb_packet(trace, cb_packet); 273 trace_cb_tick_count(trace, cb_tick); 274 trace_cb_tick_interval(trace, cb_tick); 275 276 if (trace_pstart(trace, NULL, NULL, process_result)==-1) { 269 pktcbs = trace_create_callback_set(); 270 trace_set_starting_cb(pktcbs, cb_starting); 271 trace_set_stopping_cb(pktcbs, cb_stopping); 272 trace_set_packet_cb(pktcbs, cb_packet); 273 trace_set_tick_count_cb(pktcbs, cb_tick); 274 trace_set_tick_interval_cb(pktcbs, cb_tick); 275 276 repcbs = trace_create_callback_set(); 277 trace_set_result_cb(repcbs, cb_result); 278 279 if (trace_pstart(trace, NULL, pktcbs, repcbs)==-1) { 277 280 trace_perror(trace,"Failed to start trace"); 278 281 trace_destroy(trace); 282 trace_destroy_callback_set(pktcbs); 283 trace_destroy_callback_set(repcbs); 279 284 if (!merge_inputs) 280 285 output_destroy(output); … … 292 297 293 298 trace_destroy(trace); 299 trace_destroy_callback_set(pktcbs); 300 trace_destroy_callback_set(repcbs); 294 301 295 302 if (!merge_inputs) -
tools/tracestats/Makefile.am
r29bbef0 rf625817 1 bin_PROGRAMS = tracestats tracestats_parallel1 bin_PROGRAMS = tracestats 2 2 bin_SCRIPTS = tracesummary 3 3 … … 7 7 include ../Makefile.tools 8 8 tracestats_SOURCES = tracestats.c 9 tracestats_parallel_SOURCES = tracestats_parallel.c
Note: See TracChangeset
for help on using the changeset viewer.