source: lib/data-struct/sliding_window.h

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file was ee6e802, checked in by Shane Alcock <salcock@…>, 5 years ago

Updated copyright blurb on all source files

In some cases, this meant adding copyright blurbs to files that
had never had them before.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *
3 * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4 * All rights reserved.
5 *
6 * This file is part of libtrace.
7 *
8 * This code has been developed by the University of Waikato WAND
9 * research group. For further information please see http://www.wand.net.nz/
10 *
11 * libtrace is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * libtrace is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 *
24 *
25 */
26#include <stdint.h>
27#include <stddef.h>
28
29#ifndef LIBTRACE_SLIDING_WINDOW_H
30#define LIBTRACE_SLIDING_WINDOW_H
31
32#define LIBTRACE_SLIDING_WINDOW_BLOCKING 0
33#define LIBTRACE_SLIDING_WINDOW_SPINNING 1
34
35// All of start, elements and end must be accessed in the listed order
36// if LIBTRACE_RINGBUFFER_SPINNING is to work.
37typedef struct libtrace_slidingwindow {
38        volatile size_t start;
39        size_t size;
40        volatile uint64_t start_number; 
41        void *volatile*elements;
42} libtrace_slidingwindow_t;
43
44void libtrace_slidingwindow_init(libtrace_slidingwindow_t * sw, size_t size, uint64_t start_number);
45void libtrace_zero_slidingwindow(libtrace_slidingwindow_t * sw);
46void libtrace_slidingwindow_destroy(libtrace_slidingwindow_t * sw);
47
48/*
49int libtrace_slidingwindow_is_empty(const libtrace_slidingwindow_t * sw);
50int libtrace_slidingwindow_is_full(const libtrace_slidingwindow_t * sw);
51*/
52
53/* void libtrace_slidingwindow_write(libtrace_slidingwindow_t * sw, uint64_t number, void* value); */
54int libtrace_slidingwindow_try_write(libtrace_slidingwindow_t * sw, uint64_t number, void* value);
55
56/*void* libtrace_slidingwindow_read(libtrace_slidingwindow_t *sw);*/
57int libtrace_slidingwindow_try_read(libtrace_slidingwindow_t *sw, void ** value, uint64_t *number);
58
59uint64_t libtrace_slidingwindow_read_ready(libtrace_slidingwindow_t *sw);
60/*
61void libtrace_slidingwindow_swrite(libtrace_slidingwindow_t * sw, void* value);
62int libtrace_slidingwindow_try_swrite(libtrace_slidingwindow_t * sw, void* value);
63int libtrace_slidingwindow_try_swrite_bl(libtrace_slidingwindow_t * sw, void* value);
64*/
65/*
66void * libtrace_slidingwindow_sread(libtrace_slidingwindow_t *sw);
67int libtrace_slidingwindow_try_sread(libtrace_slidingwindow_t *sw, void ** value);
68int libtrace_slidingwindow_try_sread_bl(libtrace_slidingwindow_t *sw, void ** value);
69*/
70#endif
Note: See TracBrowser for help on using the repository browser.