source: lib/data-struct/sliding_window.h @ 10553bf

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 10553bf was 5ba34eb, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Remove inlines for BSD support

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