4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 04bf7c5 was
a49a9eb,
checked in by Richard Sanger <rsangerarj@…>, 8 years ago
|
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
|
-
Property mode set to
100644
|
File size:
863 bytes
|
Line | |
---|
1 | #include <pthread.h> |
---|
2 | #include <limits.h> |
---|
3 | #include "../libtrace.h" |
---|
4 | |
---|
5 | #ifndef LIBTRACE_MESSAGE_QUEUE |
---|
6 | #define LIBTRACE_MESSAGE_QUEUE |
---|
7 | |
---|
8 | #define LIBTRACE_MQ_FAILED INT_MIN |
---|
9 | typedef struct libtrace_message_queue_t { |
---|
10 | int pipefd[2]; |
---|
11 | volatile int message_count; |
---|
12 | size_t message_len; |
---|
13 | pthread_spinlock_t spin; |
---|
14 | } libtrace_message_queue_t; |
---|
15 | |
---|
16 | void libtrace_message_queue_init(libtrace_message_queue_t *mq, size_t message_len); |
---|
17 | int libtrace_message_queue_put(libtrace_message_queue_t *mq, const void *message); |
---|
18 | int libtrace_message_queue_count(const libtrace_message_queue_t *mq); |
---|
19 | int libtrace_message_queue_get(libtrace_message_queue_t *mq, void *message); |
---|
20 | int libtrace_message_queue_try_get(libtrace_message_queue_t *mq, void *message); |
---|
21 | void libtrace_message_queue_destroy(libtrace_message_queue_t *mq); |
---|
22 | int libtrace_message_queue_get_fd(libtrace_message_queue_t *mq); |
---|
23 | |
---|
24 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.