Ignore:
Timestamp:
07/30/14 18:44:16 (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:
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/message_queue.c

    r5ba34eb ra49a9eb  
    1919{
    2020        assert(message_len);
    21         assert(pipe(mq->pipefd) != -1);
     21        ASSERT_RET(pipe(mq->pipefd), != -1);
    2222        mq->message_count = 0;
    2323        if (message_len > PIPE_BUF)
     
    4545        int ret;
    4646        assert(mq->message_len);
    47         assert(write(mq->pipefd[1], message, mq->message_len) == (int) mq->message_len);
     47        ASSERT_RET(write(mq->pipefd[1], message, mq->message_len), == (int) mq->message_len);
    4848        // Update after we've written
    4949        pthread_spin_lock(&mq->spin);
     
    7373        ret = mq->message_count--;
    7474        pthread_spin_unlock(&mq->spin);
    75         assert(read(mq->pipefd[0], message, mq->message_len) == (int) mq->message_len);
     75        ASSERT_RET(read(mq->pipefd[0], message, mq->message_len), == (int) mq->message_len);
    7676        return ret;
    7777}
     
    102102                ret = --mq->message_count;
    103103                // :( read(...) needs to be done within the *spin* lock otherwise blocking might steal our read
    104                 assert(read(mq->pipefd[0], message, mq->message_len) == (int) mq->message_len);
     104                ASSERT_RET(read(mq->pipefd[0], message, mq->message_len), == (int) mq->message_len);
    105105        } else {
    106106                ret = LIBTRACE_MQ_FAILED;
Note: See TracChangeset for help on using the changeset viewer.