- Timestamp:
- 03/25/15 14:28:31 (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:
- 5e43b8b
- Parents:
- a330384
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/combiner_ordered.c
r6a6e6a8 rf01c479 21 21 static void publish(libtrace_t *trace, int t_id, libtrace_combine_t *c, libtrace_result_t *res) { 22 22 libtrace_queue_t *queue = &((libtrace_queue_t*)c->queues)[t_id]; 23 //while (libtrace_deque_get_size(&t->deque) >= 1000) 24 // sched_yield(); 25 libtrace_deque_push_back(queue, res); // Automatically locking for us :) 26 23 27 if (libtrace_deque_get_size(queue) >= trace->config.reporter_thold) { 24 28 trace_post_reporter(trace); 25 29 } 26 //while (libtrace_deque_get_size(&t->deque) >= 1000)27 // sched_yield();28 libtrace_deque_push_back(queue, res); // Automatically locking for us :)29 30 } 30 31 … … 35 36 uint64_t key[libtrace_get_perpkt_count(trace)]; // Cached keys 36 37 uint64_t min_key = UINT64_MAX; 38 uint64_t prev_min = 0; 37 39 int min_queue = -1; 38 40 … … 55 57 } 56 58 57 /* Now remove the smallest and loop - special case if all threads have joined we always flush what's left */ 58 while ((live_count == libtrace_get_perpkt_count(trace)) || (live_count && final)) { 59 // || (live_count && ((flags & REDUCE_SEQUENTIAL && min_key == trace->expected_key))) 59 /* Now remove the smallest and loop - special case if all threads have 60 * joined we always flush what's left. Or the next smallest is the same 61 * value or less than the previous */ 62 while ((live_count == libtrace_get_perpkt_count(trace)) || (live_count && final) 63 || (live_count && prev_min >= min_key)) { 60 64 /* Get the minimum queue and then do stuff */ 61 65 libtrace_result_t r; … … 64 68 ASSERT_RET (libtrace_deque_pop_front(&queues[min_queue], (void *) &r), == 1); 65 69 trace->reporter(trace, MESSAGE_RESULT, gt, &trace->reporter_thread); 66 67 // We expect the key we read +1 now , todo put expected in our storage area68 //trace->expected_key = key[min_queue] + 1;69 70 70 71 // Now update the one we just removed … … 89 90 live[min_queue] = false; 90 91 live_count--; 92 prev_min = min_key; 91 93 min_key = UINT64_MAX; // Update our minimum 92 94 // Check all find the smallest again - all are alive 93 95 for (i = 0; i < libtrace_get_perpkt_count(trace); ++i) { 94 // Still not 100% TODO (what if order is wrong or not increasing)95 96 if (live[i] && min_key >= key[i]) { 96 97 min_key = key[i]; -
lib/combiner_unordered.c
r62b3c4e rf01c479 19 19 static void publish(libtrace_t *trace, int t_id, libtrace_combine_t *c, libtrace_result_t *res) { 20 20 libtrace_queue_t *queue = &((libtrace_queue_t*)c->queues)[t_id]; 21 libtrace_deque_push_back(queue, res); // Automatically locking for us :) 22 21 23 if (libtrace_deque_get_size(queue) >= trace->config.reporter_thold) { 22 24 trace_post_reporter(trace); 23 25 } 24 libtrace_deque_push_back(queue, res); // Automatically locking for us :)25 26 } 26 27
Note: See TracChangeset
for help on using the changeset viewer.