source: lib/trace_sliding_window.h @ 29bbef0

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 29bbef0 was 29bbef0, checked in by Richard Sanger <rsangerarj@…>, 8 years ago

My work from over summer, with a few things tidied up and updated to include recent commits/patches to bring this up to date. Still very much work in progress.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#include <pthread.h>
2#include <semaphore.h>
3#include <stdint.h>
4
5#ifndef TRACE_SLIDING_WINDOW_H
6#define TRACE_SLIDING_WINDOW_H
7
8#define LIBTRACE_SLIDING_WINDOW_BLOCKING 0
9#define LIBTRACE_SLIDING_WINDOW_SPINNING 1
10
11// All of start, elements and end must be accessed in the listed order
12// if LIBTRACE_RINGBUFFER_SPINNING is to work.
13typedef struct libtrace_slidingwindow {
14        volatile int start;
15        int size;
16        volatile uint64_t start_number; 
17        void *volatile*elements;
18} libtrace_slidingwindow_t;
19
20void libtrace_slidingwindow_init(libtrace_slidingwindow_t * sw, int size, uint64_t start_number);
21inline void libtrace_zero_slidingwindow(libtrace_slidingwindow_t * sw);
22void libtrace_slidingwindow_destroy(libtrace_slidingwindow_t * sw);
23
24/*
25int libtrace_slidingwindow_is_empty(const libtrace_slidingwindow_t * sw);
26int libtrace_slidingwindow_is_full(const libtrace_slidingwindow_t * sw);
27*/
28
29/* void libtrace_slidingwindow_write(libtrace_slidingwindow_t * sw, uint64_t number, void* value); */
30int libtrace_slidingwindow_try_write(libtrace_slidingwindow_t * sw, uint64_t number, void* value);
31
32/*void* libtrace_slidingwindow_read(libtrace_slidingwindow_t *sw);*/
33int libtrace_slidingwindow_try_read(libtrace_slidingwindow_t *sw, void ** value, uint64_t *number);
34
35inline uint64_t libtrace_slidingwindow_read_ready(libtrace_slidingwindow_t *sw);
36/*
37void libtrace_slidingwindow_swrite(libtrace_slidingwindow_t * sw, void* value);
38int libtrace_slidingwindow_try_swrite(libtrace_slidingwindow_t * sw, void* value);
39int libtrace_slidingwindow_try_swrite_bl(libtrace_slidingwindow_t * sw, void* value);
40*/
41/*
42void * libtrace_slidingwindow_sread(libtrace_slidingwindow_t *sw);
43int libtrace_slidingwindow_try_sread(libtrace_slidingwindow_t *sw, void ** value);
44int libtrace_slidingwindow_try_sread_bl(libtrace_slidingwindow_t *sw, void ** value);
45*/
46#endif
Note: See TracBrowser for help on using the repository browser.