1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
1 |
/* slabs memory allocation */
|
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
2 |
#ifndef SLABS_H
|
3 |
#define SLABS_H
|
|
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
4 |
|
1.2.3
by David Martínez Moreno
Import upstream version 1.2.4 |
5 |
/** Init the subsystem. 1st argument is the limit on no. of bytes to allocate,
|
6 |
0 if no limit. 2nd argument is the growth factor; each slab will use a chunk
|
|
1.3.1
by David Martínez Moreno
Import upstream version 1.2.5 |
7 |
size equal to the previous slab's chunk size times this factor.
|
8 |
3rd argument specifies if the slab allocator should allocate all memory
|
|
9 |
up front (if true), or allocate memory in chunks as it is needed (if false)
|
|
10 |
*/
|
|
11 |
void slabs_init(const size_t limit, const double factor, const bool prealloc); |
|
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
12 |
|
13 |
||
1.2.3
by David Martínez Moreno
Import upstream version 1.2.4 |
14 |
/**
|
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
15 |
* Given object size, return id to use when allocating/freeing memory for object
|
16 |
* 0 means error: can't store such a large object
|
|
17 |
*/
|
|
18 |
||
19 |
unsigned int slabs_clsid(const size_t size); |
|
20 |
||
1.2.3
by David Martínez Moreno
Import upstream version 1.2.4 |
21 |
/** Allocate object of given length. 0 on error */ /*@null@*/ |
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
22 |
void *slabs_alloc(const size_t size, unsigned int id); |
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
23 |
|
1.2.3
by David Martínez Moreno
Import upstream version 1.2.4 |
24 |
/** Free previously allocated object */
|
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
25 |
void slabs_free(void *ptr, size_t size, unsigned int id); |
26 |
||
1.4.4
by Arno Töll
Import upstream version 1.4.7 |
27 |
/** Adjust the stats for memory requested */
|
28 |
void slabs_adjust_mem_requested(unsigned int id, size_t old, size_t ntotal); |
|
29 |
||
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
30 |
/** Return a datum for stats in binary protocol */
|
31 |
bool get_stats(const char *stat_type, int nkey, ADD_STAT add_stats, void *c); |
|
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
32 |
|
1.2.3
by David Martínez Moreno
Import upstream version 1.2.4 |
33 |
/** Fill buffer with stats */ /*@null@*/ |
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
34 |
void slabs_stats(ADD_STAT add_stats, void *c); |
1.2.1
by Jay Bonci
Import upstream version 1.2.2 |
35 |
|
1.1.11
by Scott Kitterman
Import upstream version 1.4.11 |
36 |
int start_slab_maintenance_thread(void); |
37 |
void stop_slab_maintenance_thread(void); |
|
38 |
||
39 |
enum reassign_result_type { |
|
40 |
REASSIGN_OK=0, REASSIGN_RUNNING, REASSIGN_BADCLASS, REASSIGN_NOSPARE, |
|
1.1.13
by Clint Byrum
Import upstream version 1.4.14 |
41 |
REASSIGN_SRC_DST_SAME
|
1.1.11
by Scott Kitterman
Import upstream version 1.4.11 |
42 |
};
|
43 |
||
44 |
enum reassign_result_type slabs_reassign(int src, int dst); |
|
45 |
||
1.3.3
by David Martínez Moreno
Import upstream version 1.4.0 |
46 |
#endif
|