Ignore:
Timestamp:
09/17/14 13:45:29 (7 years ago)
Author:
Richard Sanger <rsangerarj@…>
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:
9e429e8
Parents:
2498008
Message:

Remove anything to do with the combiner from set configuration and removes any options/storage related to these such as the next expected packet.

Instead this is done using trace_set_combiner now, and the for the built-in combiners.h header. This is a lot more flexible and allows the users to specify there own combiner, and any number of options for it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/combiner_ordered.c

    r2498008 rd994324  
    44#include <assert.h>
    55#include <stdlib.h>
     6
     7/* TODO hook up configuration option for sequentual packets again */
    68
    79static int init_combiner(libtrace_t *t, libtrace_combine_t *c) {
     
    2729}
    2830
    29 static void inline read_internal(libtrace_t *trace, libtrace_queue_t *queues, bool final){
     31inline static void read_internal(libtrace_t *trace, libtrace_queue_t *queues, const bool final){
    3032        int i;
    31         int flags = trace->reporter_flags; // Hint these aren't changing
    3233        int live_count = 0;
    3334        bool live[libtrace_get_perpkt_count(trace)]; // Set if a trace is alive
     
    5556
    5657        /* Now remove the smallest and loop - special case if all threads have joined we always flush what's left */
    57         while ((live_count == libtrace_get_perpkt_count(trace)) || (live_count &&
    58                         ((flags & REDUCE_SEQUENTIAL && min_key == trace->expected_key) ||
    59                         final))) {
     58        while ((live_count == libtrace_get_perpkt_count(trace)) || (live_count && final)) {
     59                // || (live_count && ((flags & REDUCE_SEQUENTIAL && min_key == trace->expected_key)))
    6060                /* Get the minimum queue and then do stuff */
    6161                libtrace_result_t r;
     
    6565
    6666                // We expect the key we read +1 now , todo put expected in our storage area
    67                 trace->expected_key = key[min_queue] + 1;
     67                //trace->expected_key = key[min_queue] + 1;
    6868
    6969                // Now update the one we just removed
     
    120120}
    121121
    122 /** Used below in trace_make_results_packets_safe*/
    123 static void do_copy_result_packet(void *data)
    124 {
    125         libtrace_result_t *res = (libtrace_result_t *)data;
    126         if (res->type == RESULT_PACKET) {
    127                 // Duplicate the packet in standard malloc'd memory and free the
    128                 // original, This is a 1:1 exchange so is ocache count remains unchanged.
    129                 libtrace_packet_t *oldpkt, *dup;
    130                 oldpkt = (libtrace_packet_t *) res->value;
    131                 dup = trace_copy_packet(oldpkt);
    132                 res->value = (void *)dup;
    133                 trace_destroy_packet(oldpkt);
    134         }
    135 }
    136122
    137123static void pause(libtrace_t *trace, libtrace_combine_t *c) {
     
    139125        int i;
    140126        for (i = 0; i < libtrace_get_perpkt_count(trace); i++) {
    141                 libtrace_deque_apply_function(&queues[i], &do_copy_result_packet);
     127                libtrace_deque_apply_function(&queues[i], (deque_data_fn) libtrace_make_result_safe);
    142128        }
    143129}
    144130
    145 const libtrace_combine_t combiner_ordered = {
     131DLLEXPORT const libtrace_combine_t combiner_ordered = {
    146132    init_combiner,      /* initialise */
    147133        destroy,                /* destroy */
     
    151137    pause,                      /* pause */
    152138    NULL,                       /* queues */
    153     0                           /* opts */
     139    {0}                         /* opts */
    154140};
Note: See TracChangeset for help on using the changeset viewer.