Changeset be3f75b
- Timestamp:
- 07/30/14 19:17:14 (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:
- f9a70ca
- Parents:
- a49a9eb
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace_int.h
ra49a9eb rbe3f75b 204 204 */ 205 205 struct libtrace_thread_t { 206 int accepted_packets; // The number of packets accepted only used if pread 207 // is retreving packets 208 // Set to true once the first packet has been stored 209 bool recorded_first; 210 // For thread safety reason we actually must store this here 211 int64_t tracetime_offset_usec; 212 void* user_data; // TLS for the user to use 213 void* format_data; // TLS for the format to use 214 libtrace_message_queue_t messages; // Message handling 215 libtrace_ringbuffer_t rbuffer; // Input 216 libtrace_vector_t vector; // Output 217 libtrace_queue_t deque; // Real Output type makes more sense 206 218 libtrace_t * trace; 207 219 void* ret; 208 220 enum thread_types type; 209 221 enum thread_states state; 210 void* user_data; // TLS for the user to use211 void* format_data; // TLS for the format to use212 222 pthread_t tid; 213 223 int perpkt_num; // A number from 0-X that represents this perpkt threads number 214 224 // in the table, intended to quickly identify this thread 215 225 // -1 represents NA (such as the case this is not a perpkt thread) 216 libtrace_ringbuffer_t rbuffer; // Input217 libtrace_vector_t vector; // Output218 libtrace_queue_t deque; // Real Output type makes more sense219 libtrace_message_queue_t messages; // Message handling220 // Temp storage for time sensitive results221 uint64_t tmp_key;222 void *tmp_data;223 pthread_spinlock_t tmp_spinlock;224 // Set to true once the first packet has been stored225 bool recorded_first;226 // For thread safety reason we actually must store this here227 int64_t tracetime_offset_usec;228 226 }; 229 227 … … 347 345 struct first_packets first_packets; 348 346 int tracetime; 347 348 /* 349 * Caches statistic counters in the case that our trace is 350 * paused or stopped before this counter is taken 351 */ 352 uint64_t dropped_packets; 353 uint64_t received_packets; 349 354 }; 350 355 -
lib/trace.c
ra49a9eb rbe3f75b 286 286 libtrace->first_packets.count = 0; 287 287 libtrace->first_packets.packets = NULL; 288 libtrace->dropped_packets = UINT64_MAX; 289 libtrace->accepted_packets = UINT64_MAX; 288 290 289 291 /* Parse the URI to determine what sort of trace we are dealing with */ … … 1940 1942 { 1941 1943 assert(trace); 1944 uint64_t ret; 1945 1942 1946 if (trace->format->get_received_packets) { 1943 return trace->format->get_received_packets(trace); 1944 } 1945 return (uint64_t)-1; 1947 if ((ret = trace->format->get_received_packets(trace)) != UINT64_MAX) 1948 return ret; 1949 } 1950 // Read this cached value taken before the trace was closed 1951 return trace->received_packets; 1946 1952 } 1947 1953 … … 1967 1973 { 1968 1974 assert(trace); 1975 uint64_t ret; 1976 1969 1977 if (trace->format->get_dropped_packets) { 1970 return trace->format->get_dropped_packets(trace); 1971 } 1972 return (uint64_t)-1; 1978 if ((ret = trace->format->get_dropped_packets(trace)) != UINT64_MAX) 1979 return ret; 1980 } 1981 // Read this cached value taken before the trace was closed 1982 return trace->dropped_packets; 1973 1983 } 1974 1984 … … 1976 1986 { 1977 1987 assert(trace); 1978 return trace->accepted_packets; 1988 int i = 0; 1989 uint64_t ret = trace->accepted_packets; 1990 for (i = 0; i < trace->perpkt_thread_count; i++) { 1991 ret += trace->perpkt_threads[i].accepted_packets; 1992 } 1993 return ret; 1979 1994 } 1980 1995 -
lib/trace_parallel.c
ra49a9eb rbe3f75b 279 279 t->recorded_first = false; 280 280 t->perpkt_num = -1; 281 t->accepted_packets = 0; 281 282 } 282 283 … … 1248 1249 libtrace->snaplen); 1249 1250 } 1250 trace_packet_set_order(packet, libtrace->accepted_packets); 1251 ++libtrace->accepted_packets; 1251 1252 ++t->accepted_packets; 1253 // TODO look into this better 1254 trace_packet_set_order(packet, trace_get_erf_timestamp(packet)); 1255 //trace_packet_set_order(packet, libtrace->accepted_packets); 1256 //++libtrace->accepted_packets; 1252 1257 return ret; 1253 1258 } while(1); … … 1470 1475 libtrace_deque_init(&t->deque, sizeof(libtrace_result_t)); 1471 1476 libtrace_message_queue_init(&t->messages, sizeof(libtrace_message_t)); 1472 t->tmp_key = 0;1473 t->tmp_data = NULL;1474 1477 t->recorded_first = false; 1475 ASSERT_RET(pthread_spin_init(&t->tmp_spinlock, 0), == 0);1476 1478 t->tracetime_offset_usec = 0;; 1477 1479 } … … 1602 1604 1603 1605 if (trace_supports_parallel(libtrace) && !trace_has_dedicated_hasher(libtrace)) { 1606 uint64_t tmp_stats; 1607 libtrace->dropped_packets = trace_get_dropped_packets(libtrace); 1608 libtrace->received_packets = trace_get_received_packets(libtrace); 1609 if (libtrace->format->get_filtered_packets) { 1610 if ((tmp_stats = libtrace->format->get_filtered_packets(libtrace)) != UINT64_MAX) { 1611 libtrace->filtered_packets += tmp_stats; 1612 } 1613 } 1604 1614 libtrace->started = false; 1605 1615 if (libtrace->format->ppause_input)
Note: See TracChangeset
for help on using the changeset viewer.