source: lib/data-struct/sliding_window.h @ fb1fd42

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

Move the data structures out of the way and into there own folder and tidy file naming.

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