Ignore:
Timestamp:
07/30/14 18:44:16 (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:
be3f75b
Parents:
41148f2
Message:

Add an object cache with thread local caches
All packets used by a trace are put through this.
Adds bulk read/write operations to the ringbuffer (used by the object cache)
Replace semaphores with condition variables to support these bulk operations.
Internally use bulk read operations from a single threaded formats to reduce lock overhead.
Replaces the asserts around pthread_* functions with a version that will still run the command if NDEBUG

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/data-struct/ring_buffer.h

    read9478 ra49a9eb  
    2020        pthread_spinlock_t swlock;
    2121        pthread_spinlock_t srlock;
    22         sem_t semrlock;
    23         sem_t semwlock;
    24         sem_t emptys;
    25         sem_t fulls;
     22        // We need to ensure that broadcasts dont get lost hence
     23        // these locks below
     24        // We avoid using semaphores since they don't allow
     25        // multiple releases.
     26        pthread_mutex_t empty_lock;
     27        pthread_mutex_t full_lock;
     28        pthread_cond_t empty_cond; // Signal when empties are ready
     29        pthread_cond_t full_cond; // Signal when fulls are ready
    2630        // Aim to get this on a separate cache line to start - important if spinning
    2731        volatile size_t end;
     
    4650DLLEXPORT int libtrace_ringbuffer_try_sread_bl(libtrace_ringbuffer_t *rb, void ** value);
    4751
     52
     53
     54DLLEXPORT size_t libtrace_ringbuffer_write_bulk(libtrace_ringbuffer_t *rb, void *values[], size_t nb_buffers, size_t min_nb_buffers);
     55DLLEXPORT size_t libtrace_ringbuffer_read_bulk(libtrace_ringbuffer_t *rb, void *values[], size_t nb_buffers, size_t min_nb_buffers);
     56DLLEXPORT size_t libtrace_ringbuffer_sread_bulk(libtrace_ringbuffer_t *rb, void *values[], size_t nb_buffers, size_t min_nb_buffers);
     57DLLEXPORT size_t libtrace_ringbuffer_swrite_bulk(libtrace_ringbuffer_t *rb, void *values[], size_t nb_buffers, size_t min_nb_buffers);
     58
    4859#endif
Note: See TracChangeset for help on using the changeset viewer.