Changeset 2498008 for lib/data-struct


Ignore:
Timestamp:
09/16/14 02:35:10 (8 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:
d994324
Parents:
50b1bee
Message:

Refactor the combining step to allow user defined functions here.

Remove the old trace_get_results, now instead simply provide a reporter function which gets called as soon as results are ready.
The combiner function used determines the order of these results and when they are released etc.
The combiner function can be selected from those built-in or a custom version can be defined results are provided when ready.
Quickly hacked the parallel tests to work with this update, these are still a bit messy.

Also some fixes some compile warnings.

Location:
lib/data-struct
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/data-struct/vector.c

    ra49a9eb r2498008  
    5959        }
    6060        v->size--;
    61         // Of coarse this is mega slow
     61        // Of course this is mega slow
    6262        for (i = 0; i < v->size * v->element_size; i++)
    6363                v->elements[i] = v->elements[i+v->element_size];
     
    132132        ASSERT_RET(pthread_mutex_unlock(&v->lock), == 0);
    133133}
     134
     135DLLEXPORT void libtrace_vector_qsort(libtrace_vector_t *v, int (*compar)(const void *, const void*)) {
     136        ASSERT_RET(pthread_mutex_lock(&v->lock), == 0);
     137        qsort(v->elements, v->element_size, v->element_size, compar);
     138        ASSERT_RET(pthread_mutex_unlock(&v->lock), == 0);
     139}
  • lib/data-struct/vector.h

    r8c42377 r2498008  
    3030DLLEXPORT void libtrace_vector_apply_function(libtrace_vector_t *v, vector_data_fn fn);
    3131
     32// Sort the vector using qsort
     33DLLEXPORT void libtrace_vector_qsort(libtrace_vector_t *v, int (*compar)(const void *, const void*));
    3234#endif
Note: See TracChangeset for help on using the changeset viewer.