| Code Coverage: vinyl-cache/lib/libvsc/VSC_mempool.c |
| |
| 82217aa4fc7094b3610340078afaf78cd95a8ec9 |
| |
| 0 |
|
/* |
| 1 |
|
* NB: This file is machine generated, DO NOT EDIT! |
| 2 |
|
* |
| 3 |
|
* Edit mempool.vsc and run lib/libvsc/vsctool.py instead. |
| 4 |
|
*/ |
| 5 |
|
|
| 6 |
|
#include "config.h" |
| 7 |
|
#include <stdio.h> |
| 8 |
|
#include <stdarg.h> |
| 9 |
|
#include "vdef.h" |
| 10 |
|
#include "vas.h" |
| 11 |
|
#include "vrt.h" |
| 12 |
|
#include "VSC_mempool.h" |
| 13 |
|
|
| 14 |
|
static const char vsc_mempool_name[] = "MEMPOOL"; |
| 15 |
|
|
| 16 |
|
#define PARANOIA(a,n) \ |
| 17 |
|
v_static_assert( \ |
| 18 |
|
offsetof(struct VSC_mempool, a) == n, \ |
| 19 |
|
"VSC element '" #a "' at wrong offset") |
| 20 |
|
|
| 21 |
|
PARANOIA(live, 0); |
| 22 |
|
PARANOIA(pool, 8); |
| 23 |
|
PARANOIA(sz_wanted, 16); |
| 24 |
|
PARANOIA(sz_actual, 24); |
| 25 |
|
PARANOIA(allocs, 32); |
| 26 |
|
PARANOIA(frees, 40); |
| 27 |
|
PARANOIA(recycle, 48); |
| 28 |
|
PARANOIA(timeout, 56); |
| 29 |
|
PARANOIA(toosmall, 64); |
| 30 |
|
PARANOIA(surplus, 72); |
| 31 |
|
PARANOIA(randry, 80); |
| 32 |
|
#undef PARANOIA |
| 33 |
|
|
| 34 |
|
static const unsigned char vsc_mempool_json[1715] = { |
| 35 |
|
123,34,118,101,114,115,105,111,110,34,58,34,49,34,44,34,110,97,109,101, |
| 36 |
|
34,58,34,109,101,109,112,111,111,108,34,44,34,111,110,101,108,105,110, |
| 37 |
|
101,114,34,58,34,77,101,109,111,114,121,32,80,111,111,108,32,67,111, |
| 38 |
|
117,110,116,101,114,115,34,44,34,111,114,100,101,114,34,58,51,48,44, |
| 39 |
|
34,100,111,99,115,34,58,34,34,44,34,101,108,101,109,101,110,116,115, |
| 40 |
|
34,58,49,49,44,34,101,108,101,109,34,58,123,34,108,105,118,101,34,58, |
| 41 |
|
123,34,116,121,112,101,34,58,34,103,97,117,103,101,34,44,34,99,116,121, |
| 42 |
|
112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101, |
| 43 |
|
108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110,101, |
| 44 |
|
114,34,58,34,73,110,32,117,115,101,34,44,34,102,111,114,109,97,116,34, |
| 45 |
|
58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58, |
| 46 |
|
48,44,34,110,97,109,101,34,58,34,108,105,118,101,34,44,34,100,111,99, |
| 47 |
|
115,34,58,34,34,125,44,34,112,111,111,108,34,58,123,34,116,121,112,101, |
| 48 |
|
34,58,34,103,97,117,103,101,34,44,34,99,116,121,112,101,34,58,34,117, |
| 49 |
|
105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34,58,34,100,101, |
| 50 |
|
98,117,103,34,44,34,111,110,101,108,105,110,101,114,34,58,34,73,110, |
| 51 |
|
32,80,111,111,108,34,44,34,102,111,114,109,97,116,34,58,34,105,110,116, |
| 52 |
|
101,103,101,114,34,44,34,105,110,100,101,120,34,58,56,44,34,110,97,109, |
| 53 |
|
101,34,58,34,112,111,111,108,34,44,34,100,111,99,115,34,58,34,34,125, |
| 54 |
|
44,34,115,122,95,119,97,110,116,101,100,34,58,123,34,116,121,112,101, |
| 55 |
|
34,58,34,103,97,117,103,101,34,44,34,99,116,121,112,101,34,58,34,117, |
| 56 |
|
105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34,58,34,100,101, |
| 57 |
|
98,117,103,34,44,34,111,110,101,108,105,110,101,114,34,58,34,83,105, |
| 58 |
|
122,101,32,114,101,113,117,101,115,116,101,100,34,44,34,102,111,114, |
| 59 |
|
109,97,116,34,58,34,98,121,116,101,115,34,44,34,105,110,100,101,120, |
| 60 |
|
34,58,49,54,44,34,110,97,109,101,34,58,34,115,122,95,119,97,110,116, |
| 61 |
|
101,100,34,44,34,100,111,99,115,34,58,34,34,125,44,34,115,122,95,97, |
| 62 |
|
99,116,117,97,108,34,58,123,34,116,121,112,101,34,58,34,103,97,117,103, |
| 63 |
|
101,34,44,34,99,116,121,112,101,34,58,34,117,105,110,116,54,52,95,116, |
| 64 |
|
34,44,34,108,101,118,101,108,34,58,34,100,101,98,117,103,34,44,34,111, |
| 65 |
|
110,101,108,105,110,101,114,34,58,34,83,105,122,101,32,97,108,108,111, |
| 66 |
|
99,97,116,101,100,34,44,34,102,111,114,109,97,116,34,58,34,98,121,116, |
| 67 |
|
101,115,34,44,34,105,110,100,101,120,34,58,50,52,44,34,110,97,109,101, |
| 68 |
|
34,58,34,115,122,95,97,99,116,117,97,108,34,44,34,100,111,99,115,34, |
| 69 |
|
58,34,34,125,44,34,97,108,108,111,99,115,34,58,123,34,116,121,112,101, |
| 70 |
|
34,58,34,99,111,117,110,116,101,114,34,44,34,99,116,121,112,101,34,58, |
| 71 |
|
34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34,58,34, |
| 72 |
|
100,101,98,117,103,34,44,34,111,110,101,108,105,110,101,114,34,58,34, |
| 73 |
|
65,108,108,111,99,97,116,105,111,110,115,34,44,34,102,111,114,109,97, |
| 74 |
|
116,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120, |
| 75 |
|
34,58,51,50,44,34,110,97,109,101,34,58,34,97,108,108,111,99,115,34,44, |
| 76 |
|
34,100,111,99,115,34,58,34,34,125,44,34,102,114,101,101,115,34,58,123, |
| 77 |
|
34,116,121,112,101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116, |
| 78 |
|
121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118, |
| 79 |
|
101,108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110, |
| 80 |
|
101,114,34,58,34,70,114,101,101,115,34,44,34,102,111,114,109,97,116, |
| 81 |
|
34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101,120,34, |
| 82 |
|
58,52,48,44,34,110,97,109,101,34,58,34,102,114,101,101,115,34,44,34, |
| 83 |
|
100,111,99,115,34,58,34,34,125,44,34,114,101,99,121,99,108,101,34,58, |
| 84 |
|
123,34,116,121,112,101,34,58,34,99,111,117,110,116,101,114,34,44,34, |
| 85 |
|
99,116,121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108, |
| 86 |
|
101,118,101,108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108, |
| 87 |
|
105,110,101,114,34,58,34,82,101,99,121,99,108,101,100,32,102,114,111, |
| 88 |
|
109,32,112,111,111,108,34,44,34,102,111,114,109,97,116,34,58,34,105, |
| 89 |
|
110,116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,52,56,44, |
| 90 |
|
34,110,97,109,101,34,58,34,114,101,99,121,99,108,101,34,44,34,100,111, |
| 91 |
|
99,115,34,58,34,34,125,44,34,116,105,109,101,111,117,116,34,58,123,34, |
| 92 |
|
116,121,112,101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116, |
| 93 |
|
121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118, |
| 94 |
|
101,108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110, |
| 95 |
|
101,114,34,58,34,84,105,109,101,100,32,111,117,116,32,102,114,111,109, |
| 96 |
|
32,112,111,111,108,34,44,34,102,111,114,109,97,116,34,58,34,105,110, |
| 97 |
|
116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,53,54,44,34,110, |
| 98 |
|
97,109,101,34,58,34,116,105,109,101,111,117,116,34,44,34,100,111,99, |
| 99 |
|
115,34,58,34,34,125,44,34,116,111,111,115,109,97,108,108,34,58,123,34, |
| 100 |
|
116,121,112,101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116, |
| 101 |
|
121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118, |
| 102 |
|
101,108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110, |
| 103 |
|
101,114,34,58,34,84,111,111,32,115,109,97,108,108,32,116,111,32,114, |
| 104 |
|
101,99,121,99,108,101,34,44,34,102,111,114,109,97,116,34,58,34,105,110, |
| 105 |
|
116,101,103,101,114,34,44,34,105,110,100,101,120,34,58,54,52,44,34,110, |
| 106 |
|
97,109,101,34,58,34,116,111,111,115,109,97,108,108,34,44,34,100,111, |
| 107 |
|
99,115,34,58,34,34,125,44,34,115,117,114,112,108,117,115,34,58,123,34, |
| 108 |
|
116,121,112,101,34,58,34,99,111,117,110,116,101,114,34,44,34,99,116, |
| 109 |
|
121,112,101,34,58,34,117,105,110,116,54,52,95,116,34,44,34,108,101,118, |
| 110 |
|
101,108,34,58,34,100,101,98,117,103,34,44,34,111,110,101,108,105,110, |
| 111 |
|
101,114,34,58,34,84,111,111,32,109,97,110,121,32,102,111,114,32,112, |
| 112 |
|
111,111,108,34,44,34,102,111,114,109,97,116,34,58,34,105,110,116,101, |
| 113 |
|
103,101,114,34,44,34,105,110,100,101,120,34,58,55,50,44,34,110,97,109, |
| 114 |
|
101,34,58,34,115,117,114,112,108,117,115,34,44,34,100,111,99,115,34, |
| 115 |
|
58,34,34,125,44,34,114,97,110,100,114,121,34,58,123,34,116,121,112,101, |
| 116 |
|
34,58,34,99,111,117,110,116,101,114,34,44,34,99,116,121,112,101,34,58, |
| 117 |
|
34,117,105,110,116,54,52,95,116,34,44,34,108,101,118,101,108,34,58,34, |
| 118 |
|
100,101,98,117,103,34,44,34,111,110,101,108,105,110,101,114,34,58,34, |
| 119 |
|
80,111,111,108,32,114,97,110,32,100,114,121,34,44,34,102,111,114,109, |
| 120 |
|
97,116,34,58,34,105,110,116,101,103,101,114,34,44,34,105,110,100,101, |
| 121 |
|
120,34,58,56,48,44,34,110,97,109,101,34,58,34,114,97,110,100,114,121, |
| 122 |
|
34,44,34,100,111,99,115,34,58,34,34,125,125,125,0 |
| 123 |
|
}; |
| 124 |
|
|
| 125 |
|
// { |
| 126 |
|
// "version": "1", |
| 127 |
|
// "name": "mempool", |
| 128 |
|
// "oneliner": "Memory Pool Counters", |
| 129 |
|
// "order": 30, |
| 130 |
|
// "docs": "", |
| 131 |
|
// "elements": 11, |
| 132 |
|
// "elem": { |
| 133 |
|
// "live": { |
| 134 |
|
// "type": "gauge", |
| 135 |
|
// "ctype": "uint64_t", |
| 136 |
|
// "level": "debug", |
| 137 |
|
// "oneliner": "In use", |
| 138 |
|
// "format": "integer", |
| 139 |
|
// "index": 0, |
| 140 |
|
// "name": "live", |
| 141 |
|
// "docs": "" |
| 142 |
|
// }, |
| 143 |
|
// "pool": { |
| 144 |
|
// "type": "gauge", |
| 145 |
|
// "ctype": "uint64_t", |
| 146 |
|
// "level": "debug", |
| 147 |
|
// "oneliner": "In Pool", |
| 148 |
|
// "format": "integer", |
| 149 |
|
// "index": 8, |
| 150 |
|
// "name": "pool", |
| 151 |
|
// "docs": "" |
| 152 |
|
// }, |
| 153 |
|
// "sz_wanted": { |
| 154 |
|
// "type": "gauge", |
| 155 |
|
// "ctype": "uint64_t", |
| 156 |
|
// "level": "debug", |
| 157 |
|
// "oneliner": "Size requested", |
| 158 |
|
// "format": "bytes", |
| 159 |
|
// "index": 16, |
| 160 |
|
// "name": "sz_wanted", |
| 161 |
|
// "docs": "" |
| 162 |
|
// }, |
| 163 |
|
// "sz_actual": { |
| 164 |
|
// "type": "gauge", |
| 165 |
|
// "ctype": "uint64_t", |
| 166 |
|
// "level": "debug", |
| 167 |
|
// "oneliner": "Size allocated", |
| 168 |
|
// "format": "bytes", |
| 169 |
|
// "index": 24, |
| 170 |
|
// "name": "sz_actual", |
| 171 |
|
// "docs": "" |
| 172 |
|
// }, |
| 173 |
|
// "allocs": { |
| 174 |
|
// "type": "counter", |
| 175 |
|
// "ctype": "uint64_t", |
| 176 |
|
// "level": "debug", |
| 177 |
|
// "oneliner": "Allocations", |
| 178 |
|
// "format": "integer", |
| 179 |
|
// "index": 32, |
| 180 |
|
// "name": "allocs", |
| 181 |
|
// "docs": "" |
| 182 |
|
// }, |
| 183 |
|
// "frees": { |
| 184 |
|
// "type": "counter", |
| 185 |
|
// "ctype": "uint64_t", |
| 186 |
|
// "level": "debug", |
| 187 |
|
// "oneliner": "Frees", |
| 188 |
|
// "format": "integer", |
| 189 |
|
// "index": 40, |
| 190 |
|
// "name": "frees", |
| 191 |
|
// "docs": "" |
| 192 |
|
// }, |
| 193 |
|
// "recycle": { |
| 194 |
|
// "type": "counter", |
| 195 |
|
// "ctype": "uint64_t", |
| 196 |
|
// "level": "debug", |
| 197 |
|
// "oneliner": "Recycled from pool", |
| 198 |
|
// "format": "integer", |
| 199 |
|
// "index": 48, |
| 200 |
|
// "name": "recycle", |
| 201 |
|
// "docs": "" |
| 202 |
|
// }, |
| 203 |
|
// "timeout": { |
| 204 |
|
// "type": "counter", |
| 205 |
|
// "ctype": "uint64_t", |
| 206 |
|
// "level": "debug", |
| 207 |
|
// "oneliner": "Timed out from pool", |
| 208 |
|
// "format": "integer", |
| 209 |
|
// "index": 56, |
| 210 |
|
// "name": "timeout", |
| 211 |
|
// "docs": "" |
| 212 |
|
// }, |
| 213 |
|
// "toosmall": { |
| 214 |
|
// "type": "counter", |
| 215 |
|
// "ctype": "uint64_t", |
| 216 |
|
// "level": "debug", |
| 217 |
|
// "oneliner": "Too small to recycle", |
| 218 |
|
// "format": "integer", |
| 219 |
|
// "index": 64, |
| 220 |
|
// "name": "toosmall", |
| 221 |
|
// "docs": "" |
| 222 |
|
// }, |
| 223 |
|
// "surplus": { |
| 224 |
|
// "type": "counter", |
| 225 |
|
// "ctype": "uint64_t", |
| 226 |
|
// "level": "debug", |
| 227 |
|
// "oneliner": "Too many for pool", |
| 228 |
|
// "format": "integer", |
| 229 |
|
// "index": 72, |
| 230 |
|
// "name": "surplus", |
| 231 |
|
// "docs": "" |
| 232 |
|
// }, |
| 233 |
|
// "randry": { |
| 234 |
|
// "type": "counter", |
| 235 |
|
// "ctype": "uint64_t", |
| 236 |
|
// "level": "debug", |
| 237 |
|
// "oneliner": "Pool ran dry", |
| 238 |
|
// "format": "integer", |
| 239 |
|
// "index": 80, |
| 240 |
|
// "name": "randry", |
| 241 |
|
// "docs": "" |
| 242 |
|
// } |
| 243 |
|
// } |
| 244 |
|
// } |
| 245 |
|
|
| 246 |
|
|
| 247 |
|
struct VSC_mempool* |
| 248 |
|
VSC_mempool_New(struct vsmw_cluster *vc, |
| 249 |
|
struct vsc_seg **sg, const char *fmt, ...) |
| 250 |
5102 |
{ |
| 251 |
5102 |
va_list ap; |
| 252 |
5102 |
struct VSC_mempool *retval; |
| 253 |
|
|
| 254 |
5102 |
va_start(ap, fmt); |
| 255 |
5102 |
retval = VRT_VSC_Allocv(vc, sg, vsc_mempool_name, VSC_mempool_size, |
| 256 |
5102 |
vsc_mempool_json, sizeof vsc_mempool_json, fmt, ap); |
| 257 |
5102 |
va_end(ap); |
| 258 |
5102 |
return(retval); |
| 259 |
5102 |
} |
| 260 |
|
|
| 261 |
|
void |
| 262 |
|
VSC_mempool_Destroy(struct vsc_seg **sg) |
| 263 |
28 |
{ |
| 264 |
28 |
struct vsc_seg *p; |
| 265 |
|
|
| 266 |
28 |
AN(sg); |
| 267 |
28 |
p = *sg; |
| 268 |
|
*sg = NULL; |
| 269 |
28 |
VRT_VSC_Destroy(vsc_mempool_name, p); |
| 270 |
28 |
} |