source: lib/data-struct/object_cache.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.0 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#ifndef LIBTRACE_OBJECT_CACHE_H
27#define LIBTRACE_OBJECT_CACHE_H
28
29#include "ring_buffer.h"
30#include "vector.h"
31
32
33struct local_cache;
34typedef struct libtrace_ocache {
35        libtrace_ringbuffer_t rb;
36        void *(*alloc)(void);
37        void (*free)(void *);
38        size_t thread_cache_size;
39        size_t max_allocations;
40        size_t current_allocations;
41        pthread_spinlock_t spin;
42        size_t nb_thread_list;
43        size_t max_nb_thread_list;
44        struct local_cache **thread_list;
45} libtrace_ocache_t;
46
47DLLEXPORT int libtrace_ocache_init(libtrace_ocache_t *oc, void *(*alloc)(void), void (*free)(void*),
48                                    size_t thread_cache_size, size_t buffer_size, bool limit_size);
49DLLEXPORT int libtrace_ocache_destroy(libtrace_ocache_t *oc);
50DLLEXPORT size_t libtrace_ocache_alloc(libtrace_ocache_t *oc, void *values[], size_t nb_buffers, size_t min_nb_buffers);
51DLLEXPORT size_t libtrace_ocache_free(libtrace_ocache_t *oc, void *values[], size_t nb_buffers, size_t min_nb_buffers);
52DLLEXPORT void libtrace_zero_ocache(libtrace_ocache_t *oc);
53DLLEXPORT void libtrace_ocache_unregister_thread(libtrace_ocache_t *oc);
54#endif // LIBTRACE_OBJECT_CACHE_H
Note: See TracBrowser for help on using the repository browser.