Uniformly cast mallctl[bymib]() oldp/newp arguments to (void *).
This avoids warnings in some cases, and is otherwise generally good hygiene.
This commit is contained in:
parent
44df4a45cf
commit
977103c897
@ -21,7 +21,7 @@ int test_threads()
|
|||||||
je_malloc_conf = "narenas:3";
|
je_malloc_conf = "narenas:3";
|
||||||
int narenas = 0;
|
int narenas = 0;
|
||||||
size_t sz = sizeof(narenas);
|
size_t sz = sizeof(narenas);
|
||||||
je_mallctl("opt.narenas", &narenas, &sz, NULL, 0);
|
je_mallctl("opt.narenas", (void *)&narenas, &sz, NULL, 0);
|
||||||
if (narenas != 3) {
|
if (narenas != 3) {
|
||||||
printf("Error: unexpected number of arenas: %d\n", narenas);
|
printf("Error: unexpected number of arenas: %d\n", narenas);
|
||||||
return 1;
|
return 1;
|
||||||
@ -33,7 +33,7 @@ int test_threads()
|
|||||||
je_malloc_stats_print(NULL, NULL, NULL);
|
je_malloc_stats_print(NULL, NULL, NULL);
|
||||||
size_t allocated1;
|
size_t allocated1;
|
||||||
size_t sz1 = sizeof(allocated1);
|
size_t sz1 = sizeof(allocated1);
|
||||||
je_mallctl("stats.active", &allocated1, &sz1, NULL, 0);
|
je_mallctl("stats.active", (void *)&allocated1, &sz1, NULL, 0);
|
||||||
printf("\nPress Enter to start threads...\n");
|
printf("\nPress Enter to start threads...\n");
|
||||||
getchar();
|
getchar();
|
||||||
printf("Starting %d threads x %d x %d iterations...\n", numThreads, numIter1, numIter2);
|
printf("Starting %d threads x %d x %d iterations...\n", numThreads, numIter1, numIter2);
|
||||||
@ -78,7 +78,7 @@ int test_threads()
|
|||||||
}
|
}
|
||||||
je_malloc_stats_print(NULL, NULL, NULL);
|
je_malloc_stats_print(NULL, NULL, NULL);
|
||||||
size_t allocated2;
|
size_t allocated2;
|
||||||
je_mallctl("stats.active", &allocated2, &sz1, NULL, 0);
|
je_mallctl("stats.active", (void *)&allocated2, &sz1, NULL, 0);
|
||||||
size_t leaked = allocated2 - allocated1;
|
size_t leaked = allocated2 - allocated1;
|
||||||
printf("\nDone. Leaked: %zd bytes\n", leaked);
|
printf("\nDone. Leaked: %zd bytes\n", leaked);
|
||||||
bool failed = leaked > 65536; // in case C++ runtime allocated something (e.g. iostream locale or facet)
|
bool failed = leaked > 65536; // in case C++ runtime allocated something (e.g. iostream locale or facet)
|
||||||
|
44
src/stats.c
44
src/stats.c
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define CTL_GET(n, v, t) do { \
|
#define CTL_GET(n, v, t) do { \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
xmallctl(n, v, &sz, NULL, 0); \
|
xmallctl(n, (void *)v, &sz, NULL, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CTL_M2_GET(n, i, v, t) do { \
|
#define CTL_M2_GET(n, i, v, t) do { \
|
||||||
@ -12,7 +12,7 @@
|
|||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
xmallctlnametomib(n, mib, &miblen); \
|
xmallctlnametomib(n, mib, &miblen); \
|
||||||
mib[2] = (i); \
|
mib[2] = (i); \
|
||||||
xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \
|
xmallctlbymib(mib, miblen, (void *)v, &sz, NULL, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CTL_M2_M4_GET(n, i, j, v, t) do { \
|
#define CTL_M2_M4_GET(n, i, j, v, t) do { \
|
||||||
@ -22,7 +22,7 @@
|
|||||||
xmallctlnametomib(n, mib, &miblen); \
|
xmallctlnametomib(n, mib, &miblen); \
|
||||||
mib[2] = (i); \
|
mib[2] = (i); \
|
||||||
mib[4] = (j); \
|
mib[4] = (j); \
|
||||||
xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \
|
xmallctlbymib(mib, miblen, (void *)v, &sz, NULL, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -368,45 +368,51 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
"config.malloc_conf: \"%s\"\n", config_malloc_conf);
|
"config.malloc_conf: \"%s\"\n", config_malloc_conf);
|
||||||
|
|
||||||
#define OPT_WRITE_BOOL(n) \
|
#define OPT_WRITE_BOOL(n) \
|
||||||
if (je_mallctl("opt."#n, &bv, &bsz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == \
|
||||||
|
0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %s\n", bv ? "true" : "false"); \
|
" opt."#n": %s\n", bv ? "true" : "false"); \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_BOOL_MUTABLE(n, m) { \
|
#define OPT_WRITE_BOOL_MUTABLE(n, m) { \
|
||||||
bool bv2; \
|
bool bv2; \
|
||||||
if (je_mallctl("opt."#n, &bv, &bsz, NULL, 0) == 0 && \
|
if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == \
|
||||||
je_mallctl(#m, &bv2, &bsz, NULL, 0) == 0) { \
|
0 && je_mallctl(#m, &bv2, &bsz, NULL, 0) == 0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %s ("#m": %s)\n", bv ? "true" \
|
" opt."#n": %s ("#m": %s)\n", bv ? "true" \
|
||||||
: "false", bv2 ? "true" : "false"); \
|
: "false", bv2 ? "true" : "false"); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_UNSIGNED(n) \
|
#define OPT_WRITE_UNSIGNED(n) \
|
||||||
if (je_mallctl("opt."#n, &uv, &usz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&uv, &usz, NULL, 0) == \
|
||||||
|
0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %u\n", uv); \
|
" opt."#n": %u\n", uv); \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_SIZE_T(n) \
|
#define OPT_WRITE_SIZE_T(n) \
|
||||||
if (je_mallctl("opt."#n, &sv, &ssz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&sv, &ssz, NULL, 0) == \
|
||||||
|
0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %zu\n", sv); \
|
" opt."#n": %zu\n", sv); \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_SSIZE_T(n) \
|
#define OPT_WRITE_SSIZE_T(n) \
|
||||||
if (je_mallctl("opt."#n, &ssv, &sssz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) \
|
||||||
|
== 0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %zd\n", ssv); \
|
" opt."#n": %zd\n", ssv); \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_SSIZE_T_MUTABLE(n, m) { \
|
#define OPT_WRITE_SSIZE_T_MUTABLE(n, m) { \
|
||||||
ssize_t ssv2; \
|
ssize_t ssv2; \
|
||||||
if (je_mallctl("opt."#n, &ssv, &sssz, NULL, 0) == 0 && \
|
if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) \
|
||||||
je_mallctl(#m, &ssv2, &sssz, NULL, 0) == 0) { \
|
== 0 && je_mallctl(#m, &ssv2, &sssz, NULL, 0) == \
|
||||||
|
0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": %zd ("#m": %zd)\n", \
|
" opt."#n": %zd ("#m": %zd)\n", \
|
||||||
ssv, ssv2); \
|
ssv, ssv2); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define OPT_WRITE_CHAR_P(n) \
|
#define OPT_WRITE_CHAR_P(n) \
|
||||||
if (je_mallctl("opt."#n, &cpv, &cpsz, NULL, 0) == 0) { \
|
if (je_mallctl("opt."#n, (void *)&cpv, &cpsz, NULL, 0) \
|
||||||
|
== 0) { \
|
||||||
malloc_cprintf(write_cb, cbopaque, \
|
malloc_cprintf(write_cb, cbopaque, \
|
||||||
" opt."#n": \"%s\"\n", cpv); \
|
" opt."#n": \"%s\"\n", cpv); \
|
||||||
}
|
}
|
||||||
@ -462,11 +468,13 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"Unused dirty page decay time: %zd%s\n", ssv, (ssv < 0) ?
|
"Unused dirty page decay time: %zd%s\n", ssv, (ssv < 0) ?
|
||||||
" (no decay)" : "");
|
" (no decay)" : "");
|
||||||
if (je_mallctl("arenas.tcache_max", &sv, &ssz, NULL, 0) == 0) {
|
if (je_mallctl("arenas.tcache_max", (void *)&sv, &ssz, NULL, 0)
|
||||||
|
== 0) {
|
||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"Maximum thread-cached size class: %zu\n", sv);
|
"Maximum thread-cached size class: %zu\n", sv);
|
||||||
}
|
}
|
||||||
if (je_mallctl("opt.prof", &bv, &bsz, NULL, 0) == 0 && bv) {
|
if (je_mallctl("opt.prof", (void *)&bv, &bsz, NULL, 0) == 0 &&
|
||||||
|
bv) {
|
||||||
CTL_GET("prof.lg_sample", &sv, size_t);
|
CTL_GET("prof.lg_sample", &sv, size_t);
|
||||||
malloc_cprintf(write_cb, cbopaque,
|
malloc_cprintf(write_cb, cbopaque,
|
||||||
"Average profile sample interval: %"FMTu64
|
"Average profile sample interval: %"FMTu64
|
||||||
@ -509,8 +517,8 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
unsigned i, ninitialized;
|
unsigned i, ninitialized;
|
||||||
|
|
||||||
isz = sizeof(bool) * narenas;
|
isz = sizeof(bool) * narenas;
|
||||||
xmallctl("arenas.initialized", initialized,
|
xmallctl("arenas.initialized",
|
||||||
&isz, NULL, 0);
|
(void *)initialized, &isz, NULL, 0);
|
||||||
for (i = ninitialized = 0; i < narenas; i++) {
|
for (i = ninitialized = 0; i < narenas; i++) {
|
||||||
if (initialized[i])
|
if (initialized[i])
|
||||||
ninitialized++;
|
ninitialized++;
|
||||||
@ -538,8 +546,8 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
isz = sizeof(bool) * narenas;
|
isz = sizeof(bool) * narenas;
|
||||||
xmallctl("arenas.initialized", initialized,
|
xmallctl("arenas.initialized",
|
||||||
&isz, NULL, 0);
|
(void *)initialized, &isz, NULL, 0);
|
||||||
|
|
||||||
for (i = 0; i < narenas; i++) {
|
for (i = 0; i < narenas; i++) {
|
||||||
if (initialized[i]) {
|
if (initialized[i]) {
|
||||||
|
@ -502,10 +502,10 @@ tcache_boot(tsdn_t *tsdn)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* If necessary, clamp opt_lg_tcache_max. */
|
/* If necessary, clamp opt_lg_tcache_max. */
|
||||||
if (opt_lg_tcache_max < 0 || (1U << opt_lg_tcache_max) < SMALL_MAXCLASS)
|
if (opt_lg_tcache_max < 0 || (ZU(1) << opt_lg_tcache_max) < SMALL_MAXCLASS)
|
||||||
tcache_maxclass = SMALL_MAXCLASS;
|
tcache_maxclass = SMALL_MAXCLASS;
|
||||||
else
|
else
|
||||||
tcache_maxclass = (1U << opt_lg_tcache_max);
|
tcache_maxclass = (ZU(1) << opt_lg_tcache_max);
|
||||||
|
|
||||||
nhbins = size2index(tcache_maxclass) + 1;
|
nhbins = size2index(tcache_maxclass) + 1;
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
if (neg)
|
if (neg)
|
||||||
ret = -ret;
|
ret = (uintmax_t)(-((intmax_t)ret));
|
||||||
|
|
||||||
if (p == ns) {
|
if (p == ns) {
|
||||||
/* No conversion performed. */
|
/* No conversion performed. */
|
||||||
|
@ -19,8 +19,8 @@ thd_start(void *arg)
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(arena_ind);
|
sz = sizeof(arena_ind);
|
||||||
assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
"Error in arenas.extend");
|
0, "Error in arenas.extend");
|
||||||
|
|
||||||
if (thread_ind % 4 != 3) {
|
if (thread_ind % 4 != 3) {
|
||||||
size_t mib[3];
|
size_t mib[3];
|
||||||
|
@ -18,14 +18,14 @@ thd_start(void *arg)
|
|||||||
size_t sz, usize;
|
size_t sz, usize;
|
||||||
|
|
||||||
sz = sizeof(a0);
|
sz = sizeof(a0);
|
||||||
if ((err = mallctl("thread.allocated", &a0, &sz, NULL, 0))) {
|
if ((err = mallctl("thread.allocated", (void *)&a0, &sz, NULL, 0))) {
|
||||||
if (err == ENOENT)
|
if (err == ENOENT)
|
||||||
goto label_ENOENT;
|
goto label_ENOENT;
|
||||||
test_fail("%s(): Error in mallctl(): %s", __func__,
|
test_fail("%s(): Error in mallctl(): %s", __func__,
|
||||||
strerror(err));
|
strerror(err));
|
||||||
}
|
}
|
||||||
sz = sizeof(ap0);
|
sz = sizeof(ap0);
|
||||||
if ((err = mallctl("thread.allocatedp", &ap0, &sz, NULL, 0))) {
|
if ((err = mallctl("thread.allocatedp", (void *)&ap0, &sz, NULL, 0))) {
|
||||||
if (err == ENOENT)
|
if (err == ENOENT)
|
||||||
goto label_ENOENT;
|
goto label_ENOENT;
|
||||||
test_fail("%s(): Error in mallctl(): %s", __func__,
|
test_fail("%s(): Error in mallctl(): %s", __func__,
|
||||||
@ -36,14 +36,15 @@ thd_start(void *arg)
|
|||||||
"storage");
|
"storage");
|
||||||
|
|
||||||
sz = sizeof(d0);
|
sz = sizeof(d0);
|
||||||
if ((err = mallctl("thread.deallocated", &d0, &sz, NULL, 0))) {
|
if ((err = mallctl("thread.deallocated", (void *)&d0, &sz, NULL, 0))) {
|
||||||
if (err == ENOENT)
|
if (err == ENOENT)
|
||||||
goto label_ENOENT;
|
goto label_ENOENT;
|
||||||
test_fail("%s(): Error in mallctl(): %s", __func__,
|
test_fail("%s(): Error in mallctl(): %s", __func__,
|
||||||
strerror(err));
|
strerror(err));
|
||||||
}
|
}
|
||||||
sz = sizeof(dp0);
|
sz = sizeof(dp0);
|
||||||
if ((err = mallctl("thread.deallocatedp", &dp0, &sz, NULL, 0))) {
|
if ((err = mallctl("thread.deallocatedp", (void *)&dp0, &sz, NULL,
|
||||||
|
0))) {
|
||||||
if (err == ENOENT)
|
if (err == ENOENT)
|
||||||
goto label_ENOENT;
|
goto label_ENOENT;
|
||||||
test_fail("%s(): Error in mallctl(): %s", __func__,
|
test_fail("%s(): Error in mallctl(): %s", __func__,
|
||||||
@ -57,9 +58,9 @@ thd_start(void *arg)
|
|||||||
assert_ptr_not_null(p, "Unexpected malloc() error");
|
assert_ptr_not_null(p, "Unexpected malloc() error");
|
||||||
|
|
||||||
sz = sizeof(a1);
|
sz = sizeof(a1);
|
||||||
mallctl("thread.allocated", &a1, &sz, NULL, 0);
|
mallctl("thread.allocated", (void *)&a1, &sz, NULL, 0);
|
||||||
sz = sizeof(ap1);
|
sz = sizeof(ap1);
|
||||||
mallctl("thread.allocatedp", &ap1, &sz, NULL, 0);
|
mallctl("thread.allocatedp", (void *)&ap1, &sz, NULL, 0);
|
||||||
assert_u64_eq(*ap1, a1,
|
assert_u64_eq(*ap1, a1,
|
||||||
"Dereferenced \"thread.allocatedp\" value should equal "
|
"Dereferenced \"thread.allocatedp\" value should equal "
|
||||||
"\"thread.allocated\" value");
|
"\"thread.allocated\" value");
|
||||||
@ -74,9 +75,9 @@ thd_start(void *arg)
|
|||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
sz = sizeof(d1);
|
sz = sizeof(d1);
|
||||||
mallctl("thread.deallocated", &d1, &sz, NULL, 0);
|
mallctl("thread.deallocated", (void *)&d1, &sz, NULL, 0);
|
||||||
sz = sizeof(dp1);
|
sz = sizeof(dp1);
|
||||||
mallctl("thread.deallocatedp", &dp1, &sz, NULL, 0);
|
mallctl("thread.deallocatedp", (void *)&dp1, &sz, NULL, 0);
|
||||||
assert_u64_eq(*dp1, d1,
|
assert_u64_eq(*dp1, d1,
|
||||||
"Dereferenced \"thread.deallocatedp\" value should equal "
|
"Dereferenced \"thread.deallocatedp\" value should equal "
|
||||||
"\"thread.deallocated\" value");
|
"\"thread.deallocated\" value");
|
||||||
|
@ -194,8 +194,8 @@ TEST_BEGIN(test_extent)
|
|||||||
bool xallocx_success_a, xallocx_success_b, xallocx_success_c;
|
bool xallocx_success_a, xallocx_success_b, xallocx_success_c;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
||||||
|
|
||||||
/* Install custom extent hooks. */
|
/* Install custom extent hooks. */
|
||||||
@ -205,8 +205,9 @@ TEST_BEGIN(test_extent)
|
|||||||
hooks_mib[1] = (size_t)arena_ind;
|
hooks_mib[1] = (size_t)arena_ind;
|
||||||
old_size = sizeof(extent_hooks_t *);
|
old_size = sizeof(extent_hooks_t *);
|
||||||
new_size = sizeof(extent_hooks_t *);
|
new_size = sizeof(extent_hooks_t *);
|
||||||
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, &old_hooks, &old_size,
|
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, (void *)&old_hooks,
|
||||||
&new_hooks, new_size), 0, "Unexpected extent_hooks error");
|
&old_size, (void *)&new_hooks, new_size), 0,
|
||||||
|
"Unexpected extent_hooks error");
|
||||||
orig_hooks = old_hooks;
|
orig_hooks = old_hooks;
|
||||||
assert_ptr_ne(old_hooks->alloc, extent_alloc, "Unexpected alloc error");
|
assert_ptr_ne(old_hooks->alloc, extent_alloc, "Unexpected alloc error");
|
||||||
assert_ptr_ne(old_hooks->dalloc, extent_dalloc,
|
assert_ptr_ne(old_hooks->dalloc, extent_dalloc,
|
||||||
@ -221,12 +222,12 @@ TEST_BEGIN(test_extent)
|
|||||||
|
|
||||||
/* Get large size classes. */
|
/* Get large size classes. */
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("arenas.lextent.0.size", &large0, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&large0, &sz, NULL,
|
||||||
"Unexpected arenas.lextent.0.size failure");
|
0), 0, "Unexpected arenas.lextent.0.size failure");
|
||||||
assert_d_eq(mallctl("arenas.lextent.1.size", &large1, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.1.size", (void *)&large1, &sz, NULL,
|
||||||
"Unexpected arenas.lextent.1.size failure");
|
0), 0, "Unexpected arenas.lextent.1.size failure");
|
||||||
assert_d_eq(mallctl("arenas.lextent.2.size", &large2, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.2.size", (void *)&large2, &sz, NULL,
|
||||||
"Unexpected arenas.lextent.2.size failure");
|
0), 0, "Unexpected arenas.lextent.2.size failure");
|
||||||
|
|
||||||
/* Test dalloc/decommit/purge cascade. */
|
/* Test dalloc/decommit/purge cascade. */
|
||||||
purge_miblen = sizeof(purge_mib)/sizeof(size_t);
|
purge_miblen = sizeof(purge_mib)/sizeof(size_t);
|
||||||
@ -287,9 +288,9 @@ TEST_BEGIN(test_extent)
|
|||||||
|
|
||||||
/* Restore extent hooks. */
|
/* Restore extent hooks. */
|
||||||
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, NULL, NULL,
|
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, NULL, NULL,
|
||||||
&old_hooks, new_size), 0, "Unexpected extent_hooks error");
|
(void *)&old_hooks, new_size), 0, "Unexpected extent_hooks error");
|
||||||
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, &old_hooks, &old_size,
|
assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, (void *)&old_hooks,
|
||||||
NULL, 0), 0, "Unexpected extent_hooks error");
|
&old_size, NULL, 0), 0, "Unexpected extent_hooks error");
|
||||||
assert_ptr_eq(old_hooks, orig_hooks, "Unexpected hooks error");
|
assert_ptr_eq(old_hooks, orig_hooks, "Unexpected hooks error");
|
||||||
assert_ptr_eq(old_hooks->alloc, orig_hooks->alloc,
|
assert_ptr_eq(old_hooks->alloc, orig_hooks->alloc,
|
||||||
"Unexpected alloc error");
|
"Unexpected alloc error");
|
||||||
|
@ -11,7 +11,7 @@ get_nsizes_impl(const char *cmd)
|
|||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
z = sizeof(unsigned);
|
z = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
|
assert_d_eq(mallctl(cmd, (void *)&ret, &z, NULL, 0), 0,
|
||||||
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -37,7 +37,7 @@ get_size_impl(const char *cmd, size_t ind)
|
|||||||
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
||||||
mib[2] = ind;
|
mib[2] = ind;
|
||||||
z = sizeof(size_t);
|
z = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&ret, &z, NULL, 0),
|
||||||
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
|
@ -8,8 +8,8 @@ TEST_BEGIN(test_overflow)
|
|||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.nlextents", &nlextents, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
|
||||||
"Unexpected mallctl() error");
|
0), 0, "Unexpected mallctl() error");
|
||||||
|
|
||||||
miblen = sizeof(mib) / sizeof(size_t);
|
miblen = sizeof(mib) / sizeof(size_t);
|
||||||
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
||||||
@ -17,8 +17,8 @@ TEST_BEGIN(test_overflow)
|
|||||||
mib[2] = nlextents - 1;
|
mib[2] = nlextents - 1;
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&max_size_class, &sz,
|
||||||
"Unexpected mallctlbymib() error");
|
NULL, 0), 0, "Unexpected mallctlbymib() error");
|
||||||
|
|
||||||
assert_ptr_null(malloc(max_size_class + 1),
|
assert_ptr_null(malloc(max_size_class + 1),
|
||||||
"Expected OOM due to over-sized allocation request");
|
"Expected OOM due to over-sized allocation request");
|
||||||
|
@ -7,7 +7,7 @@ get_nsizes_impl(const char *cmd)
|
|||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
z = sizeof(unsigned);
|
z = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
|
assert_d_eq(mallctl(cmd, (void *)&ret, &z, NULL, 0), 0,
|
||||||
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -33,7 +33,7 @@ get_size_impl(const char *cmd, size_t ind)
|
|||||||
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
||||||
mib[2] = ind;
|
mib[2] = ind;
|
||||||
z = sizeof(size_t);
|
z = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&ret, &z, NULL, 0),
|
||||||
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
|
@ -16,8 +16,8 @@ thd_start(void *arg)
|
|||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
size = sizeof(arena_ind);
|
size = sizeof(arena_ind);
|
||||||
if ((err = mallctl("thread.arena", &arena_ind, &size, &main_arena_ind,
|
if ((err = mallctl("thread.arena", (void *)&arena_ind, &size,
|
||||||
sizeof(main_arena_ind)))) {
|
(void *)&main_arena_ind, sizeof(main_arena_ind)))) {
|
||||||
char buf[BUFERROR_BUF];
|
char buf[BUFERROR_BUF];
|
||||||
|
|
||||||
buferror(err, buf, sizeof(buf));
|
buferror(err, buf, sizeof(buf));
|
||||||
@ -25,7 +25,8 @@ thd_start(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size = sizeof(arena_ind);
|
size = sizeof(arena_ind);
|
||||||
if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) {
|
if ((err = mallctl("thread.arena", (void *)&arena_ind, &size, NULL,
|
||||||
|
0))) {
|
||||||
char buf[BUFERROR_BUF];
|
char buf[BUFERROR_BUF];
|
||||||
|
|
||||||
buferror(err, buf, sizeof(buf));
|
buferror(err, buf, sizeof(buf));
|
||||||
@ -50,7 +51,8 @@ TEST_BEGIN(test_thread_arena)
|
|||||||
assert_ptr_not_null(p, "Error in malloc()");
|
assert_ptr_not_null(p, "Error in malloc()");
|
||||||
|
|
||||||
size = sizeof(arena_ind);
|
size = sizeof(arena_ind);
|
||||||
if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) {
|
if ((err = mallctl("thread.arena", (void *)&arena_ind, &size, NULL,
|
||||||
|
0))) {
|
||||||
char buf[BUFERROR_BUF];
|
char buf[BUFERROR_BUF];
|
||||||
|
|
||||||
buferror(err, buf, sizeof(buf));
|
buferror(err, buf, sizeof(buf));
|
||||||
|
@ -16,7 +16,8 @@ thd_start(void *arg)
|
|||||||
bool e0, e1;
|
bool e0, e1;
|
||||||
|
|
||||||
sz = sizeof(bool);
|
sz = sizeof(bool);
|
||||||
if ((err = mallctl("thread.tcache.enabled", &e0, &sz, NULL, 0))) {
|
if ((err = mallctl("thread.tcache.enabled", (void *)&e0, &sz, NULL,
|
||||||
|
0))) {
|
||||||
if (err == ENOENT) {
|
if (err == ENOENT) {
|
||||||
assert_false(config_tcache,
|
assert_false(config_tcache,
|
||||||
"ENOENT should only be returned if tcache is "
|
"ENOENT should only be returned if tcache is "
|
||||||
@ -27,53 +28,53 @@ thd_start(void *arg)
|
|||||||
|
|
||||||
if (e0) {
|
if (e0) {
|
||||||
e1 = false;
|
e1 = false;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz),
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
0, "Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_true(e0, "tcache should be enabled");
|
assert_true(e0, "tcache should be enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
e1 = true;
|
e1 = true;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_false(e0, "tcache should be disabled");
|
assert_false(e0, "tcache should be disabled");
|
||||||
|
|
||||||
e1 = true;
|
e1 = true;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_true(e0, "tcache should be enabled");
|
assert_true(e0, "tcache should be enabled");
|
||||||
|
|
||||||
e1 = false;
|
e1 = false;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_true(e0, "tcache should be enabled");
|
assert_true(e0, "tcache should be enabled");
|
||||||
|
|
||||||
e1 = false;
|
e1 = false;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_false(e0, "tcache should be disabled");
|
assert_false(e0, "tcache should be disabled");
|
||||||
|
|
||||||
free(malloc(1));
|
free(malloc(1));
|
||||||
e1 = true;
|
e1 = true;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_false(e0, "tcache should be disabled");
|
assert_false(e0, "tcache should be disabled");
|
||||||
|
|
||||||
free(malloc(1));
|
free(malloc(1));
|
||||||
e1 = true;
|
e1 = true;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_true(e0, "tcache should be enabled");
|
assert_true(e0, "tcache should be enabled");
|
||||||
|
|
||||||
free(malloc(1));
|
free(malloc(1));
|
||||||
e1 = false;
|
e1 = false;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_true(e0, "tcache should be enabled");
|
assert_true(e0, "tcache should be enabled");
|
||||||
|
|
||||||
free(malloc(1));
|
free(malloc(1));
|
||||||
e1 = false;
|
e1 = false;
|
||||||
assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
|
assert_d_eq(mallctl("thread.tcache.enabled", (void *)&e0, &sz,
|
||||||
"Unexpected mallctl() error");
|
(void *)&e1, sz), 0, "Unexpected mallctl() error");
|
||||||
assert_false(e0, "tcache should be disabled");
|
assert_false(e0, "tcache should be disabled");
|
||||||
|
|
||||||
free(malloc(1));
|
free(malloc(1));
|
||||||
|
@ -16,8 +16,8 @@ arena_ind(void)
|
|||||||
|
|
||||||
if (ind == 0) {
|
if (ind == 0) {
|
||||||
size_t sz = sizeof(ind);
|
size_t sz = sizeof(ind);
|
||||||
assert_d_eq(mallctl("arenas.extend", &ind, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", (void *)&ind, &sz, NULL,
|
||||||
"Unexpected mallctl failure creating arena");
|
0), 0, "Unexpected mallctl failure creating arena");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ind);
|
return (ind);
|
||||||
@ -78,7 +78,7 @@ get_nsizes_impl(const char *cmd)
|
|||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
z = sizeof(unsigned);
|
z = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
|
assert_d_eq(mallctl(cmd, (void *)&ret, &z, NULL, 0), 0,
|
||||||
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -111,7 +111,7 @@ get_size_impl(const char *cmd, size_t ind)
|
|||||||
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
||||||
mib[2] = ind;
|
mib[2] = ind;
|
||||||
z = sizeof(size_t);
|
z = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&ret, &z, NULL, 0),
|
||||||
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
|
@ -11,7 +11,7 @@ get_nsizes_impl(const char *cmd)
|
|||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
z = sizeof(unsigned);
|
z = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
|
assert_d_eq(mallctl(cmd, (void *)&ret, &z, NULL, 0), 0,
|
||||||
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
"Unexpected mallctl(\"%s\", ...) failure", cmd);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -44,7 +44,7 @@ get_size_impl(const char *cmd, size_t ind)
|
|||||||
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
|
||||||
mib[2] = ind;
|
mib[2] = ind;
|
||||||
z = sizeof(size_t);
|
z = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&ret, &z, NULL, 0),
|
||||||
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -90,8 +90,8 @@ TEST_BEGIN(test_arena_reset)
|
|||||||
tsdn_t *tsdn;
|
tsdn_t *tsdn;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", (void *)&arena_ind, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ TEST_BEGIN(test_decay_ticks)
|
|||||||
"Unexpected failure getting decay ticker");
|
"Unexpected failure getting decay ticker");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("arenas.lextent.0.size", &large0, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&large0, &sz, NULL,
|
||||||
"Unexpected mallctl failure");
|
0), 0, "Unexpected mallctl failure");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test the standard APIs using a large size class, since we can't
|
* Test the standard APIs using a large size class, since we can't
|
||||||
@ -170,8 +170,8 @@ TEST_BEGIN(test_decay_ticks)
|
|||||||
tcache_sizes[1] = 1;
|
tcache_sizes[1] = 1;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("tcache.create", &tcache_ind, &sz, NULL, 0),
|
assert_d_eq(mallctl("tcache.create", (void *)&tcache_ind, &sz,
|
||||||
0, "Unexpected mallctl failure");
|
NULL, 0), 0, "Unexpected mallctl failure");
|
||||||
|
|
||||||
for (i = 0; i < sizeof(tcache_sizes) / sizeof(size_t); i++) {
|
for (i = 0; i < sizeof(tcache_sizes) / sizeof(size_t); i++) {
|
||||||
sz = tcache_sizes[i];
|
sz = tcache_sizes[i];
|
||||||
@ -188,7 +188,7 @@ TEST_BEGIN(test_decay_ticks)
|
|||||||
dallocx(p, MALLOCX_TCACHE(tcache_ind));
|
dallocx(p, MALLOCX_TCACHE(tcache_ind));
|
||||||
tick0 = ticker_read(decay_ticker);
|
tick0 = ticker_read(decay_ticker);
|
||||||
assert_d_eq(mallctl("tcache.flush", NULL, NULL,
|
assert_d_eq(mallctl("tcache.flush", NULL, NULL,
|
||||||
&tcache_ind, sizeof(unsigned)), 0,
|
(void *)&tcache_ind, sizeof(unsigned)), 0,
|
||||||
"Unexpected mallctl failure");
|
"Unexpected mallctl failure");
|
||||||
tick1 = ticker_read(decay_ticker);
|
tick1 = ticker_read(decay_ticker);
|
||||||
assert_u32_ne(tick1, tick0,
|
assert_u32_ne(tick1, tick0,
|
||||||
@ -221,8 +221,8 @@ TEST_BEGIN(test_decay_ticker)
|
|||||||
size_t tcache_max;
|
size_t tcache_max;
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("arenas.tcache_max", &tcache_max, &sz, NULL,
|
assert_d_eq(mallctl("arenas.tcache_max", (void *)&tcache_max,
|
||||||
0), 0, "Unexpected mallctl failure");
|
&sz, NULL, 0), 0, "Unexpected mallctl failure");
|
||||||
large = nallocx(tcache_max + 1, flags);
|
large = nallocx(tcache_max + 1, flags);
|
||||||
} else {
|
} else {
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
@ -232,11 +232,11 @@ TEST_BEGIN(test_decay_ticker)
|
|||||||
|
|
||||||
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
||||||
"Unexpected mallctl failure");
|
"Unexpected mallctl failure");
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
"Unexpected mallctl failure");
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge0, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge0, &sz,
|
||||||
config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
||||||
|
|
||||||
for (i = 0; i < NPS; i++) {
|
for (i = 0; i < NPS; i++) {
|
||||||
ps[i] = mallocx(large, flags);
|
ps[i] = mallocx(large, flags);
|
||||||
@ -276,11 +276,11 @@ TEST_BEGIN(test_decay_ticker)
|
|||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
dallocx(p, flags);
|
dallocx(p, flags);
|
||||||
}
|
}
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge1, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge1,
|
||||||
NULL, 0), config_stats ? 0 : ENOENT,
|
&sz, NULL, 0), config_stats ? 0 : ENOENT,
|
||||||
"Unexpected mallctl result");
|
"Unexpected mallctl result");
|
||||||
|
|
||||||
nstime_update(&time);
|
nstime_update(&time);
|
||||||
@ -304,16 +304,16 @@ TEST_BEGIN(test_decay_nonmonotonic)
|
|||||||
unsigned i, nupdates0;
|
unsigned i, nupdates0;
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("arenas.lextent.0.size", &large0, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&large0, &sz, NULL,
|
||||||
"Unexpected mallctl failure");
|
0), 0, "Unexpected mallctl failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
||||||
"Unexpected mallctl failure");
|
"Unexpected mallctl failure");
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
"Unexpected mallctl failure");
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge0, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge0, &sz,
|
||||||
config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
||||||
|
|
||||||
nupdates_mock = 0;
|
nupdates_mock = 0;
|
||||||
nstime_init(&time_mock, 0);
|
nstime_init(&time_mock, 0);
|
||||||
@ -339,11 +339,11 @@ TEST_BEGIN(test_decay_nonmonotonic)
|
|||||||
"Expected nstime_update() to be called");
|
"Expected nstime_update() to be called");
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
"Unexpected mallctl failure");
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge1, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge1, &sz,
|
||||||
config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
||||||
|
|
||||||
if (config_stats)
|
if (config_stats)
|
||||||
assert_u64_eq(npurge0, npurge1, "Unexpected purging occurred");
|
assert_u64_eq(npurge0, npurge1, "Unexpected purging occurred");
|
||||||
|
@ -13,7 +13,7 @@ TEST_BEGIN(test_small_extent_size)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.nbins", &nbins, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.nbins", (void *)&nbins, &sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl failure");
|
"Unexpected mallctl failure");
|
||||||
|
|
||||||
assert_d_eq(mallctlnametomib("arenas.bin.0.slab_size", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arenas.bin.0.slab_size", mib, &miblen), 0,
|
||||||
@ -21,8 +21,8 @@ TEST_BEGIN(test_small_extent_size)
|
|||||||
for (i = 0; i < nbins; i++) {
|
for (i = 0; i < nbins; i++) {
|
||||||
mib[2] = i;
|
mib[2] = i;
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &extent_size, &sz, NULL,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&extent_size, &sz,
|
||||||
0), 0, "Unexpected mallctlbymib failure");
|
NULL, 0), 0, "Unexpected mallctlbymib failure");
|
||||||
assert_zu_eq(extent_size,
|
assert_zu_eq(extent_size,
|
||||||
extent_size_quantize_floor(extent_size),
|
extent_size_quantize_floor(extent_size),
|
||||||
"Small extent quantization should be a no-op "
|
"Small extent quantization should be a no-op "
|
||||||
@ -49,12 +49,12 @@ TEST_BEGIN(test_large_extent_size)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sz = sizeof(bool);
|
sz = sizeof(bool);
|
||||||
assert_d_eq(mallctl("config.cache_oblivious", &cache_oblivious, &sz,
|
assert_d_eq(mallctl("config.cache_oblivious", (void *)&cache_oblivious,
|
||||||
NULL, 0), 0, "Unexpected mallctl failure");
|
&sz, NULL, 0), 0, "Unexpected mallctl failure");
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.nlextents", &nlextents, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
|
||||||
"Unexpected mallctl failure");
|
0), 0, "Unexpected mallctl failure");
|
||||||
|
|
||||||
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
||||||
"Unexpected mallctlnametomib failure");
|
"Unexpected mallctlnametomib failure");
|
||||||
@ -63,8 +63,8 @@ TEST_BEGIN(test_large_extent_size)
|
|||||||
|
|
||||||
mib[2] = i;
|
mib[2] = i;
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &lextent_size, &sz, NULL,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&lextent_size,
|
||||||
0), 0, "Unexpected mallctlbymib failure");
|
&sz, NULL, 0), 0, "Unexpected mallctlbymib failure");
|
||||||
extent_size = cache_oblivious ? lextent_size + PAGE :
|
extent_size = cache_oblivious ? lextent_size + PAGE :
|
||||||
lextent_size;
|
lextent_size;
|
||||||
floor = extent_size_quantize_floor(extent_size);
|
floor = extent_size_quantize_floor(extent_size);
|
||||||
|
@ -12,16 +12,18 @@ TEST_BEGIN(test_mallctl_errors)
|
|||||||
EPERM, "mallctl() should return EPERM on attempt to write "
|
EPERM, "mallctl() should return EPERM on attempt to write "
|
||||||
"read-only value");
|
"read-only value");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)-1),
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
EINVAL, "mallctl() should return EINVAL for input size mismatch");
|
sizeof(epoch)-1), EINVAL,
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)+1),
|
"mallctl() should return EINVAL for input size mismatch");
|
||||||
EINVAL, "mallctl() should return EINVAL for input size mismatch");
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
||||||
|
sizeof(epoch)+1), EINVAL,
|
||||||
|
"mallctl() should return EINVAL for input size mismatch");
|
||||||
|
|
||||||
sz = sizeof(epoch)-1;
|
sz = sizeof(epoch)-1;
|
||||||
assert_d_eq(mallctl("epoch", &epoch, &sz, NULL, 0), EINVAL,
|
assert_d_eq(mallctl("epoch", (void *)&epoch, &sz, NULL, 0), EINVAL,
|
||||||
"mallctl() should return EINVAL for output size mismatch");
|
"mallctl() should return EINVAL for output size mismatch");
|
||||||
sz = sizeof(epoch)+1;
|
sz = sizeof(epoch)+1;
|
||||||
assert_d_eq(mallctl("epoch", &epoch, &sz, NULL, 0), EINVAL,
|
assert_d_eq(mallctl("epoch", (void *)&epoch, &sz, NULL, 0), EINVAL,
|
||||||
"mallctl() should return EINVAL for output size mismatch");
|
"mallctl() should return EINVAL for output size mismatch");
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
@ -56,18 +58,20 @@ TEST_BEGIN(test_mallctlbymib_errors)
|
|||||||
assert_d_eq(mallctlnametomib("epoch", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("epoch", mib, &miblen), 0,
|
||||||
"Unexpected mallctlnametomib() failure");
|
"Unexpected mallctlnametomib() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, &epoch,
|
assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, (void *)&epoch,
|
||||||
sizeof(epoch)-1), EINVAL,
|
sizeof(epoch)-1), EINVAL,
|
||||||
"mallctlbymib() should return EINVAL for input size mismatch");
|
"mallctlbymib() should return EINVAL for input size mismatch");
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, &epoch,
|
assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, (void *)&epoch,
|
||||||
sizeof(epoch)+1), EINVAL,
|
sizeof(epoch)+1), EINVAL,
|
||||||
"mallctlbymib() should return EINVAL for input size mismatch");
|
"mallctlbymib() should return EINVAL for input size mismatch");
|
||||||
|
|
||||||
sz = sizeof(epoch)-1;
|
sz = sizeof(epoch)-1;
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &epoch, &sz, NULL, 0), EINVAL,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&epoch, &sz, NULL, 0),
|
||||||
|
EINVAL,
|
||||||
"mallctlbymib() should return EINVAL for output size mismatch");
|
"mallctlbymib() should return EINVAL for output size mismatch");
|
||||||
sz = sizeof(epoch)+1;
|
sz = sizeof(epoch)+1;
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &epoch, &sz, NULL, 0), EINVAL,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&epoch, &sz, NULL, 0),
|
||||||
|
EINVAL,
|
||||||
"mallctlbymib() should return EINVAL for output size mismatch");
|
"mallctlbymib() should return EINVAL for output size mismatch");
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
@ -83,18 +87,19 @@ TEST_BEGIN(test_mallctl_read_write)
|
|||||||
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
||||||
|
|
||||||
/* Read. */
|
/* Read. */
|
||||||
assert_d_eq(mallctl("epoch", &old_epoch, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("epoch", (void *)&old_epoch, &sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
||||||
|
|
||||||
/* Write. */
|
/* Write. */
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &new_epoch, sizeof(new_epoch)),
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&new_epoch,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(new_epoch)), 0, "Unexpected mallctl() failure");
|
||||||
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
||||||
|
|
||||||
/* Read+write. */
|
/* Read+write. */
|
||||||
assert_d_eq(mallctl("epoch", &old_epoch, &sz, &new_epoch,
|
assert_d_eq(mallctl("epoch", (void *)&old_epoch, &sz,
|
||||||
sizeof(new_epoch)), 0, "Unexpected mallctl() failure");
|
(void *)&new_epoch, sizeof(new_epoch)), 0,
|
||||||
|
"Unexpected mallctl() failure");
|
||||||
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
@ -120,8 +125,8 @@ TEST_BEGIN(test_mallctl_config)
|
|||||||
#define TEST_MALLCTL_CONFIG(config, t) do { \
|
#define TEST_MALLCTL_CONFIG(config, t) do { \
|
||||||
t oldval; \
|
t oldval; \
|
||||||
size_t sz = sizeof(oldval); \
|
size_t sz = sizeof(oldval); \
|
||||||
assert_d_eq(mallctl("config."#config, &oldval, &sz, NULL, 0), \
|
assert_d_eq(mallctl("config."#config, (void *)&oldval, &sz, \
|
||||||
0, "Unexpected mallctl() failure"); \
|
NULL, 0), 0, "Unexpected mallctl() failure"); \
|
||||||
assert_b_eq(oldval, config_##config, "Incorrect config value"); \
|
assert_b_eq(oldval, config_##config, "Incorrect config value"); \
|
||||||
assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
|
assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -153,7 +158,8 @@ TEST_BEGIN(test_mallctl_opt)
|
|||||||
t oldval; \
|
t oldval; \
|
||||||
size_t sz = sizeof(oldval); \
|
size_t sz = sizeof(oldval); \
|
||||||
int expected = config_##config ? 0 : ENOENT; \
|
int expected = config_##config ? 0 : ENOENT; \
|
||||||
int result = mallctl("opt."#opt, &oldval, &sz, NULL, 0); \
|
int result = mallctl("opt."#opt, (void *)&oldval, &sz, NULL, \
|
||||||
|
0); \
|
||||||
assert_d_eq(result, expected, \
|
assert_d_eq(result, expected, \
|
||||||
"Unexpected mallctl() result for opt."#opt); \
|
"Unexpected mallctl() result for opt."#opt); \
|
||||||
assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
|
assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
|
||||||
@ -191,7 +197,7 @@ TEST_BEGIN(test_manpage_example)
|
|||||||
size_t len, miblen;
|
size_t len, miblen;
|
||||||
|
|
||||||
len = sizeof(nbins);
|
len = sizeof(nbins);
|
||||||
assert_d_eq(mallctl("arenas.nbins", &nbins, &len, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.nbins", (void *)&nbins, &len, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
miblen = 4;
|
miblen = 4;
|
||||||
@ -202,8 +208,8 @@ TEST_BEGIN(test_manpage_example)
|
|||||||
|
|
||||||
mib[2] = i;
|
mib[2] = i;
|
||||||
len = sizeof(bin_size);
|
len = sizeof(bin_size);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0),
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&bin_size, &len,
|
||||||
0, "Unexpected mallctlbymib() failure");
|
NULL, 0), 0, "Unexpected mallctlbymib() failure");
|
||||||
/* Do something with bin_size... */
|
/* Do something with bin_size... */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,25 +258,25 @@ TEST_BEGIN(test_tcache)
|
|||||||
/* Create tcaches. */
|
/* Create tcaches. */
|
||||||
for (i = 0; i < NTCACHES; i++) {
|
for (i = 0; i < NTCACHES; i++) {
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("tcache.create", &tis[i], &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("tcache.create", (void *)&tis[i], &sz, NULL,
|
||||||
"Unexpected mallctl() failure, i=%u", i);
|
0), 0, "Unexpected mallctl() failure, i=%u", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exercise tcache ID recycling. */
|
/* Exercise tcache ID recycling. */
|
||||||
for (i = 0; i < NTCACHES; i++) {
|
for (i = 0; i < NTCACHES; i++) {
|
||||||
assert_d_eq(mallctl("tcache.destroy", NULL, NULL, &tis[i],
|
assert_d_eq(mallctl("tcache.destroy", NULL, NULL,
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
(void *)&tis[i], sizeof(unsigned)), 0,
|
||||||
i);
|
"Unexpected mallctl() failure, i=%u", i);
|
||||||
}
|
}
|
||||||
for (i = 0; i < NTCACHES; i++) {
|
for (i = 0; i < NTCACHES; i++) {
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("tcache.create", &tis[i], &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("tcache.create", (void *)&tis[i], &sz, NULL,
|
||||||
"Unexpected mallctl() failure, i=%u", i);
|
0), 0, "Unexpected mallctl() failure, i=%u", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush empty tcaches. */
|
/* Flush empty tcaches. */
|
||||||
for (i = 0; i < NTCACHES; i++) {
|
for (i = 0; i < NTCACHES; i++) {
|
||||||
assert_d_eq(mallctl("tcache.flush", NULL, NULL, &tis[i],
|
assert_d_eq(mallctl("tcache.flush", NULL, NULL, (void *)&tis[i],
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
@ -315,16 +321,16 @@ TEST_BEGIN(test_tcache)
|
|||||||
|
|
||||||
/* Flush some non-empty tcaches. */
|
/* Flush some non-empty tcaches. */
|
||||||
for (i = 0; i < NTCACHES/2; i++) {
|
for (i = 0; i < NTCACHES/2; i++) {
|
||||||
assert_d_eq(mallctl("tcache.flush", NULL, NULL, &tis[i],
|
assert_d_eq(mallctl("tcache.flush", NULL, NULL, (void *)&tis[i],
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
||||||
i);
|
i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy tcaches. */
|
/* Destroy tcaches. */
|
||||||
for (i = 0; i < NTCACHES; i++) {
|
for (i = 0; i < NTCACHES; i++) {
|
||||||
assert_d_eq(mallctl("tcache.destroy", NULL, NULL, &tis[i],
|
assert_d_eq(mallctl("tcache.destroy", NULL, NULL,
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
|
(void *)&tis[i], sizeof(unsigned)), 0,
|
||||||
i);
|
"Unexpected mallctl() failure, i=%u", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
@ -334,15 +340,17 @@ TEST_BEGIN(test_thread_arena)
|
|||||||
unsigned arena_old, arena_new, narenas;
|
unsigned arena_old, arena_new, narenas;
|
||||||
size_t sz = sizeof(unsigned);
|
size_t sz = sizeof(unsigned);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");
|
assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");
|
||||||
arena_new = narenas - 1;
|
arena_new = narenas - 1;
|
||||||
assert_d_eq(mallctl("thread.arena", &arena_old, &sz, &arena_new,
|
assert_d_eq(mallctl("thread.arena", (void *)&arena_old, &sz,
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure");
|
(void *)&arena_new, sizeof(unsigned)), 0,
|
||||||
|
"Unexpected mallctl() failure");
|
||||||
arena_new = 0;
|
arena_new = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", &arena_old, &sz, &arena_new,
|
assert_d_eq(mallctl("thread.arena", (void *)&arena_old, &sz,
|
||||||
sizeof(unsigned)), 0, "Unexpected mallctl() failure");
|
(void *)&arena_new, sizeof(unsigned)), 0,
|
||||||
|
"Unexpected mallctl() failure");
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
|
|
||||||
@ -351,25 +359,25 @@ TEST_BEGIN(test_arena_i_decay_time)
|
|||||||
ssize_t decay_time, orig_decay_time, prev_decay_time;
|
ssize_t decay_time, orig_decay_time, prev_decay_time;
|
||||||
size_t sz = sizeof(ssize_t);
|
size_t sz = sizeof(ssize_t);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arena.0.decay_time", &orig_decay_time, &sz,
|
assert_d_eq(mallctl("arena.0.decay_time", (void *)&orig_decay_time, &sz,
|
||||||
NULL, 0), 0, "Unexpected mallctl() failure");
|
NULL, 0), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
decay_time = -2;
|
decay_time = -2;
|
||||||
assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
|
assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
|
||||||
&decay_time, sizeof(ssize_t)), EFAULT,
|
(void *)&decay_time, sizeof(ssize_t)), EFAULT,
|
||||||
"Unexpected mallctl() success");
|
"Unexpected mallctl() success");
|
||||||
|
|
||||||
decay_time = 0x7fffffff;
|
decay_time = 0x7fffffff;
|
||||||
assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
|
assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
|
||||||
&decay_time, sizeof(ssize_t)), 0,
|
(void *)&decay_time, sizeof(ssize_t)), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
for (prev_decay_time = decay_time, decay_time = -1;
|
for (prev_decay_time = decay_time, decay_time = -1;
|
||||||
decay_time < 20; prev_decay_time = decay_time, decay_time++) {
|
decay_time < 20; prev_decay_time = decay_time, decay_time++) {
|
||||||
ssize_t old_decay_time;
|
ssize_t old_decay_time;
|
||||||
|
|
||||||
assert_d_eq(mallctl("arena.0.decay_time", &old_decay_time,
|
assert_d_eq(mallctl("arena.0.decay_time", (void *)&old_decay_time,
|
||||||
&sz, &decay_time, sizeof(ssize_t)), 0,
|
&sz, (void *)&decay_time, sizeof(ssize_t)), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
assert_zd_eq(old_decay_time, prev_decay_time,
|
assert_zd_eq(old_decay_time, prev_decay_time,
|
||||||
"Unexpected old arena.0.decay_time");
|
"Unexpected old arena.0.decay_time");
|
||||||
@ -387,8 +395,8 @@ TEST_BEGIN(test_arena_i_purge)
|
|||||||
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
assert_d_eq(mallctlnametomib("arena.0.purge", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arena.0.purge", mib, &miblen), 0,
|
||||||
"Unexpected mallctlnametomib() failure");
|
"Unexpected mallctlnametomib() failure");
|
||||||
mib[1] = narenas;
|
mib[1] = narenas;
|
||||||
@ -407,8 +415,8 @@ TEST_BEGIN(test_arena_i_decay)
|
|||||||
assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
|
assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
assert_d_eq(mallctlnametomib("arena.0.decay", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arena.0.decay", mib, &miblen), 0,
|
||||||
"Unexpected mallctlnametomib() failure");
|
"Unexpected mallctlnametomib() failure");
|
||||||
mib[1] = narenas;
|
mib[1] = narenas;
|
||||||
@ -429,31 +437,35 @@ TEST_BEGIN(test_arena_i_dss)
|
|||||||
"Unexpected mallctlnametomib() error");
|
"Unexpected mallctlnametomib() error");
|
||||||
|
|
||||||
dss_prec_new = "disabled";
|
dss_prec_new = "disabled";
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, &dss_prec_new,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_old, &sz,
|
||||||
sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
|
(void *)&dss_prec_new, sizeof(dss_prec_new)), 0,
|
||||||
|
"Unexpected mallctl() failure");
|
||||||
assert_str_ne(dss_prec_old, "primary",
|
assert_str_ne(dss_prec_old, "primary",
|
||||||
"Unexpected default for dss precedence");
|
"Unexpected default for dss precedence");
|
||||||
|
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_new, &sz, &dss_prec_old,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_new, &sz,
|
||||||
sizeof(dss_prec_old)), 0, "Unexpected mallctl() failure");
|
(void *)&dss_prec_old, sizeof(dss_prec_old)), 0,
|
||||||
|
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, NULL, 0), 0,
|
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_old, &sz, NULL,
|
||||||
|
0), 0, "Unexpected mallctl() failure");
|
||||||
assert_str_ne(dss_prec_old, "primary",
|
assert_str_ne(dss_prec_old, "primary",
|
||||||
"Unexpected value for dss precedence");
|
"Unexpected value for dss precedence");
|
||||||
|
|
||||||
mib[1] = narenas_total_get();
|
mib[1] = narenas_total_get();
|
||||||
dss_prec_new = "disabled";
|
dss_prec_new = "disabled";
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, &dss_prec_new,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_old, &sz,
|
||||||
sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
|
(void *)&dss_prec_new, sizeof(dss_prec_new)), 0,
|
||||||
|
"Unexpected mallctl() failure");
|
||||||
assert_str_ne(dss_prec_old, "primary",
|
assert_str_ne(dss_prec_old, "primary",
|
||||||
"Unexpected default for dss precedence");
|
"Unexpected default for dss precedence");
|
||||||
|
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_new, &sz, &dss_prec_old,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_new, &sz,
|
||||||
sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
|
(void *)&dss_prec_old, sizeof(dss_prec_new)), 0,
|
||||||
|
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, NULL, 0), 0,
|
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&dss_prec_old, &sz, NULL,
|
||||||
|
0), 0, "Unexpected mallctl() failure");
|
||||||
assert_str_ne(dss_prec_old, "primary",
|
assert_str_ne(dss_prec_old, "primary",
|
||||||
"Unexpected value for dss precedence");
|
"Unexpected value for dss precedence");
|
||||||
}
|
}
|
||||||
@ -464,14 +476,14 @@ TEST_BEGIN(test_arenas_initialized)
|
|||||||
unsigned narenas;
|
unsigned narenas;
|
||||||
size_t sz = sizeof(narenas);
|
size_t sz = sizeof(narenas);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
{
|
{
|
||||||
VARIABLE_ARRAY(bool, initialized, narenas);
|
VARIABLE_ARRAY(bool, initialized, narenas);
|
||||||
|
|
||||||
sz = narenas * sizeof(bool);
|
sz = narenas * sizeof(bool);
|
||||||
assert_d_eq(mallctl("arenas.initialized", initialized, &sz,
|
assert_d_eq(mallctl("arenas.initialized", (void *)initialized,
|
||||||
NULL, 0), 0, "Unexpected mallctl() failure");
|
&sz, NULL, 0), 0, "Unexpected mallctl() failure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TEST_END
|
TEST_END
|
||||||
@ -481,26 +493,26 @@ TEST_BEGIN(test_arenas_decay_time)
|
|||||||
ssize_t decay_time, orig_decay_time, prev_decay_time;
|
ssize_t decay_time, orig_decay_time, prev_decay_time;
|
||||||
size_t sz = sizeof(ssize_t);
|
size_t sz = sizeof(ssize_t);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.decay_time", &orig_decay_time, &sz,
|
assert_d_eq(mallctl("arenas.decay_time", (void *)&orig_decay_time, &sz,
|
||||||
NULL, 0), 0, "Unexpected mallctl() failure");
|
NULL, 0), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
decay_time = -2;
|
decay_time = -2;
|
||||||
assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
|
assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
|
||||||
&decay_time, sizeof(ssize_t)), EFAULT,
|
(void *)&decay_time, sizeof(ssize_t)), EFAULT,
|
||||||
"Unexpected mallctl() success");
|
"Unexpected mallctl() success");
|
||||||
|
|
||||||
decay_time = 0x7fffffff;
|
decay_time = 0x7fffffff;
|
||||||
assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
|
assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
|
||||||
&decay_time, sizeof(ssize_t)), 0,
|
(void *)&decay_time, sizeof(ssize_t)), 0,
|
||||||
"Expected mallctl() failure");
|
"Expected mallctl() failure");
|
||||||
|
|
||||||
for (prev_decay_time = decay_time, decay_time = -1;
|
for (prev_decay_time = decay_time, decay_time = -1;
|
||||||
decay_time < 20; prev_decay_time = decay_time, decay_time++) {
|
decay_time < 20; prev_decay_time = decay_time, decay_time++) {
|
||||||
ssize_t old_decay_time;
|
ssize_t old_decay_time;
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.decay_time", &old_decay_time,
|
assert_d_eq(mallctl("arenas.decay_time",
|
||||||
&sz, &decay_time, sizeof(ssize_t)), 0,
|
(void *)&old_decay_time, &sz, (void *)&decay_time,
|
||||||
"Unexpected mallctl() failure");
|
sizeof(ssize_t)), 0, "Unexpected mallctl() failure");
|
||||||
assert_zd_eq(old_decay_time, prev_decay_time,
|
assert_zd_eq(old_decay_time, prev_decay_time,
|
||||||
"Unexpected old arenas.decay_time");
|
"Unexpected old arenas.decay_time");
|
||||||
}
|
}
|
||||||
@ -513,8 +525,8 @@ TEST_BEGIN(test_arenas_constants)
|
|||||||
#define TEST_ARENAS_CONSTANT(t, name, expected) do { \
|
#define TEST_ARENAS_CONSTANT(t, name, expected) do { \
|
||||||
t name; \
|
t name; \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
assert_d_eq(mallctl("arenas."#name, &name, &sz, NULL, 0), 0, \
|
assert_d_eq(mallctl("arenas."#name, (void *)&name, &sz, NULL, \
|
||||||
"Unexpected mallctl() failure"); \
|
0), 0, "Unexpected mallctl() failure"); \
|
||||||
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -533,8 +545,8 @@ TEST_BEGIN(test_arenas_bin_constants)
|
|||||||
#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
|
#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
|
||||||
t name; \
|
t name; \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
assert_d_eq(mallctl("arenas.bin.0."#name, &name, &sz, NULL, 0), \
|
assert_d_eq(mallctl("arenas.bin.0."#name, (void *)&name, &sz, \
|
||||||
0, "Unexpected mallctl() failure"); \
|
NULL, 0), 0, "Unexpected mallctl() failure"); \
|
||||||
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -553,8 +565,8 @@ TEST_BEGIN(test_arenas_lextent_constants)
|
|||||||
#define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \
|
#define TEST_ARENAS_LEXTENT_CONSTANT(t, name, expected) do { \
|
||||||
t name; \
|
t name; \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
assert_d_eq(mallctl("arenas.lextent.0."#name, &name, &sz, NULL, \
|
assert_d_eq(mallctl("arenas.lextent.0."#name, (void *)&name, \
|
||||||
0), 0, "Unexpected mallctl() failure"); \
|
&sz, NULL, 0), 0, "Unexpected mallctl() failure"); \
|
||||||
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
assert_zu_eq(name, expected, "Incorrect "#name" size"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -569,12 +581,12 @@ TEST_BEGIN(test_arenas_extend)
|
|||||||
unsigned narenas_before, arena, narenas_after;
|
unsigned narenas_before, arena, narenas_after;
|
||||||
size_t sz = sizeof(unsigned);
|
size_t sz = sizeof(unsigned);
|
||||||
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas_before, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_before, &sz,
|
||||||
"Unexpected mallctl() failure");
|
NULL, 0), 0, "Unexpected mallctl() failure");
|
||||||
assert_d_eq(mallctl("arenas.extend", &arena, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.extend", (void *)&arena, &sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
|
||||||
assert_d_eq(mallctl("arenas.narenas", &narenas_after, &sz, NULL, 0), 0,
|
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
assert_d_eq(mallctl("arenas.narenas", (void *)&narenas_after, &sz, NULL,
|
||||||
|
0), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
assert_u_eq(narenas_before+1, narenas_after,
|
assert_u_eq(narenas_before+1, narenas_after,
|
||||||
"Unexpected number of arenas before versus after extension");
|
"Unexpected number of arenas before versus after extension");
|
||||||
@ -588,8 +600,8 @@ TEST_BEGIN(test_stats_arenas)
|
|||||||
#define TEST_STATS_ARENAS(t, name) do { \
|
#define TEST_STATS_ARENAS(t, name) do { \
|
||||||
t name; \
|
t name; \
|
||||||
size_t sz = sizeof(t); \
|
size_t sz = sizeof(t); \
|
||||||
assert_d_eq(mallctl("stats.arenas.0."#name, &name, &sz, NULL, \
|
assert_d_eq(mallctl("stats.arenas.0."#name, (void *)&name, &sz, \
|
||||||
0), 0, "Unexpected mallctl() failure"); \
|
NULL, 0), 0, "Unexpected mallctl() failure"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
TEST_STATS_ARENAS(unsigned, nthreads);
|
TEST_STATS_ARENAS(unsigned, nthreads);
|
||||||
|
@ -68,8 +68,9 @@ TEST_BEGIN(test_idump)
|
|||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
|
assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
|
||||||
0, "Unexpected mallctl failure while activating profiling");
|
sizeof(active)), 0,
|
||||||
|
"Unexpected mallctl failure while activating profiling");
|
||||||
|
|
||||||
prof_dump_open = prof_dump_open_intercept;
|
prof_dump_open = prof_dump_open_intercept;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ mallctl_bool_get(const char *name, bool expected, const char *func, int line)
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(old);
|
sz = sizeof(old);
|
||||||
assert_d_eq(mallctl(name, &old, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl(name, (void *)&old, &sz, NULL, 0), 0,
|
||||||
"%s():%d: Unexpected mallctl failure reading %s", func, line, name);
|
"%s():%d: Unexpected mallctl failure reading %s", func, line, name);
|
||||||
assert_b_eq(old, expected, "%s():%d: Unexpected %s value", func, line,
|
assert_b_eq(old, expected, "%s():%d: Unexpected %s value", func, line,
|
||||||
name);
|
name);
|
||||||
@ -26,7 +26,8 @@ mallctl_bool_set(const char *name, bool old_expected, bool val_new,
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(old);
|
sz = sizeof(old);
|
||||||
assert_d_eq(mallctl(name, &old, &sz, &val_new, sizeof(val_new)), 0,
|
assert_d_eq(mallctl(name, (void *)&old, &sz, (void *)&val_new,
|
||||||
|
sizeof(val_new)), 0,
|
||||||
"%s():%d: Unexpected mallctl failure reading/writing %s", func,
|
"%s():%d: Unexpected mallctl failure reading/writing %s", func,
|
||||||
line, name);
|
line, name);
|
||||||
assert_b_eq(old, old_expected, "%s():%d: Unexpected %s value", func,
|
assert_b_eq(old, old_expected, "%s():%d: Unexpected %s value", func,
|
||||||
|
@ -28,8 +28,9 @@ TEST_BEGIN(test_gdump)
|
|||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
|
assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
|
||||||
0, "Unexpected mallctl failure while activating profiling");
|
sizeof(active)), 0,
|
||||||
|
"Unexpected mallctl failure while activating profiling");
|
||||||
|
|
||||||
prof_dump_open = prof_dump_open_intercept;
|
prof_dump_open = prof_dump_open_intercept;
|
||||||
|
|
||||||
@ -45,8 +46,8 @@ TEST_BEGIN(test_gdump)
|
|||||||
|
|
||||||
gdump = false;
|
gdump = false;
|
||||||
sz = sizeof(gdump_old);
|
sz = sizeof(gdump_old);
|
||||||
assert_d_eq(mallctl("prof.gdump", &gdump_old, &sz, &gdump,
|
assert_d_eq(mallctl("prof.gdump", (void *)&gdump_old, &sz,
|
||||||
sizeof(gdump)), 0,
|
(void *)&gdump, sizeof(gdump)), 0,
|
||||||
"Unexpected mallctl failure while disabling prof.gdump");
|
"Unexpected mallctl failure while disabling prof.gdump");
|
||||||
assert(gdump_old);
|
assert(gdump_old);
|
||||||
did_prof_dump_open = false;
|
did_prof_dump_open = false;
|
||||||
@ -56,8 +57,8 @@ TEST_BEGIN(test_gdump)
|
|||||||
|
|
||||||
gdump = true;
|
gdump = true;
|
||||||
sz = sizeof(gdump_old);
|
sz = sizeof(gdump_old);
|
||||||
assert_d_eq(mallctl("prof.gdump", &gdump_old, &sz, &gdump,
|
assert_d_eq(mallctl("prof.gdump", (void *)&gdump_old, &sz,
|
||||||
sizeof(gdump)), 0,
|
(void *)&gdump, sizeof(gdump)), 0,
|
||||||
"Unexpected mallctl failure while enabling prof.gdump");
|
"Unexpected mallctl failure while enabling prof.gdump");
|
||||||
assert(!gdump_old);
|
assert(!gdump_old);
|
||||||
did_prof_dump_open = false;
|
did_prof_dump_open = false;
|
||||||
|
@ -36,8 +36,9 @@ TEST_BEGIN(test_idump)
|
|||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
active = true;
|
active = true;
|
||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
|
assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
|
||||||
0, "Unexpected mallctl failure while activating profiling");
|
sizeof(active)), 0,
|
||||||
|
"Unexpected mallctl failure while activating profiling");
|
||||||
|
|
||||||
prof_dump_open = prof_dump_open_intercept;
|
prof_dump_open = prof_dump_open_intercept;
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ static void
|
|||||||
set_prof_active(bool active)
|
set_prof_active(bool active)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
|
assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active,
|
||||||
0, "Unexpected mallctl failure");
|
sizeof(active)), 0, "Unexpected mallctl failure");
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
@ -30,7 +30,8 @@ get_lg_prof_sample(void)
|
|||||||
size_t lg_prof_sample;
|
size_t lg_prof_sample;
|
||||||
size_t sz = sizeof(size_t);
|
size_t sz = sizeof(size_t);
|
||||||
|
|
||||||
assert_d_eq(mallctl("prof.lg_sample", &lg_prof_sample, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("prof.lg_sample", (void *)&lg_prof_sample, &sz,
|
||||||
|
NULL, 0), 0,
|
||||||
"Unexpected mallctl failure while reading profiling sample rate");
|
"Unexpected mallctl failure while reading profiling sample rate");
|
||||||
return (lg_prof_sample);
|
return (lg_prof_sample);
|
||||||
}
|
}
|
||||||
@ -39,7 +40,7 @@ static void
|
|||||||
do_prof_reset(size_t lg_prof_sample)
|
do_prof_reset(size_t lg_prof_sample)
|
||||||
{
|
{
|
||||||
assert_d_eq(mallctl("prof.reset", NULL, NULL,
|
assert_d_eq(mallctl("prof.reset", NULL, NULL,
|
||||||
&lg_prof_sample, sizeof(size_t)), 0,
|
(void *)&lg_prof_sample, sizeof(size_t)), 0,
|
||||||
"Unexpected mallctl failure while resetting profile data");
|
"Unexpected mallctl failure while resetting profile data");
|
||||||
assert_zu_eq(lg_prof_sample, get_lg_prof_sample(),
|
assert_zu_eq(lg_prof_sample, get_lg_prof_sample(),
|
||||||
"Expected profile sample rate change");
|
"Expected profile sample rate change");
|
||||||
@ -54,8 +55,8 @@ TEST_BEGIN(test_prof_reset_basic)
|
|||||||
test_skip_if(!config_prof);
|
test_skip_if(!config_prof);
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("opt.lg_prof_sample", &lg_prof_sample_orig, &sz,
|
assert_d_eq(mallctl("opt.lg_prof_sample", (void *)&lg_prof_sample_orig,
|
||||||
NULL, 0), 0,
|
&sz, NULL, 0), 0,
|
||||||
"Unexpected mallctl failure while reading profiling sample rate");
|
"Unexpected mallctl failure while reading profiling sample rate");
|
||||||
assert_zu_eq(lg_prof_sample_orig, 0,
|
assert_zu_eq(lg_prof_sample_orig, 0,
|
||||||
"Unexpected profiling sample rate");
|
"Unexpected profiling sample rate");
|
||||||
|
@ -12,8 +12,9 @@ mallctl_thread_name_get_impl(const char *thread_name_expected, const char *func,
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(thread_name_old);
|
sz = sizeof(thread_name_old);
|
||||||
assert_d_eq(mallctl("thread.prof.name", &thread_name_old, &sz, NULL, 0),
|
assert_d_eq(mallctl("thread.prof.name", (void *)&thread_name_old, &sz,
|
||||||
0, "%s():%d: Unexpected mallctl failure reading thread.prof.name",
|
NULL, 0), 0,
|
||||||
|
"%s():%d: Unexpected mallctl failure reading thread.prof.name",
|
||||||
func, line);
|
func, line);
|
||||||
assert_str_eq(thread_name_old, thread_name_expected,
|
assert_str_eq(thread_name_old, thread_name_expected,
|
||||||
"%s():%d: Unexpected thread.prof.name value", func, line);
|
"%s():%d: Unexpected thread.prof.name value", func, line);
|
||||||
@ -26,8 +27,8 @@ mallctl_thread_name_set_impl(const char *thread_name, const char *func,
|
|||||||
int line)
|
int line)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
|
assert_d_eq(mallctl("thread.prof.name", NULL, NULL,
|
||||||
sizeof(thread_name)), 0,
|
(void *)&thread_name, sizeof(thread_name)), 0,
|
||||||
"%s():%d: Unexpected mallctl failure reading thread.prof.name",
|
"%s():%d: Unexpected mallctl failure reading thread.prof.name",
|
||||||
func, line);
|
func, line);
|
||||||
mallctl_thread_name_get_impl(thread_name, func, line);
|
mallctl_thread_name_get_impl(thread_name, func, line);
|
||||||
@ -46,15 +47,15 @@ TEST_BEGIN(test_prof_thread_name_validation)
|
|||||||
|
|
||||||
/* NULL input shouldn't be allowed. */
|
/* NULL input shouldn't be allowed. */
|
||||||
thread_name = NULL;
|
thread_name = NULL;
|
||||||
assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
|
assert_d_eq(mallctl("thread.prof.name", NULL, NULL,
|
||||||
sizeof(thread_name)), EFAULT,
|
(void *)&thread_name, sizeof(thread_name)), EFAULT,
|
||||||
"Unexpected mallctl result writing \"%s\" to thread.prof.name",
|
"Unexpected mallctl result writing \"%s\" to thread.prof.name",
|
||||||
thread_name);
|
thread_name);
|
||||||
|
|
||||||
/* '\n' shouldn't be allowed. */
|
/* '\n' shouldn't be allowed. */
|
||||||
thread_name = "hi\nthere";
|
thread_name = "hi\nthere";
|
||||||
assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
|
assert_d_eq(mallctl("thread.prof.name", NULL, NULL,
|
||||||
sizeof(thread_name)), EFAULT,
|
(void *)&thread_name, sizeof(thread_name)), EFAULT,
|
||||||
"Unexpected mallctl result writing \"%s\" to thread.prof.name",
|
"Unexpected mallctl result writing \"%s\" to thread.prof.name",
|
||||||
thread_name);
|
thread_name);
|
||||||
|
|
||||||
@ -64,8 +65,9 @@ TEST_BEGIN(test_prof_thread_name_validation)
|
|||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
sz = sizeof(thread_name_old);
|
sz = sizeof(thread_name_old);
|
||||||
assert_d_eq(mallctl("thread.prof.name", &thread_name_old, &sz,
|
assert_d_eq(mallctl("thread.prof.name",
|
||||||
&thread_name, sizeof(thread_name)), EPERM,
|
(void *)&thread_name_old, &sz, (void *)&thread_name,
|
||||||
|
sizeof(thread_name)), EPERM,
|
||||||
"Unexpected mallctl result writing \"%s\" to "
|
"Unexpected mallctl result writing \"%s\" to "
|
||||||
"thread.prof.name", thread_name);
|
"thread.prof.name", thread_name);
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ get_max_size_class(void)
|
|||||||
size_t sz, miblen, max_size_class;
|
size_t sz, miblen, max_size_class;
|
||||||
|
|
||||||
sz = sizeof(unsigned);
|
sz = sizeof(unsigned);
|
||||||
assert_d_eq(mallctl("arenas.nlextents", &nlextents, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.nlextents", (void *)&nlextents, &sz, NULL,
|
||||||
"Unexpected mallctl() error");
|
0), 0, "Unexpected mallctl() error");
|
||||||
|
|
||||||
miblen = sizeof(mib) / sizeof(size_t);
|
miblen = sizeof(mib) / sizeof(size_t);
|
||||||
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
assert_d_eq(mallctlnametomib("arenas.lextent.0.size", mib, &miblen), 0,
|
||||||
@ -17,8 +17,8 @@ get_max_size_class(void)
|
|||||||
mib[2] = nlextents - 1;
|
mib[2] = nlextents - 1;
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0,
|
assert_d_eq(mallctlbymib(mib, miblen, (void *)&max_size_class, &sz,
|
||||||
"Unexpected mallctlbymib() error");
|
NULL, 0), 0, "Unexpected mallctlbymib() error");
|
||||||
|
|
||||||
return (max_size_class);
|
return (max_size_class);
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@ TEST_BEGIN(test_stats_summary)
|
|||||||
int expected = config_stats ? 0 : ENOENT;
|
int expected = config_stats ? 0 : ENOENT;
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.allocated", &allocated, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.allocated", (void *)&allocated, &sz, NULL,
|
||||||
|
0), expected, "Unexpected mallctl() result");
|
||||||
|
assert_d_eq(mallctl("stats.active", (void *)&active, &sz, NULL, 0),
|
||||||
expected, "Unexpected mallctl() result");
|
expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.active", &active, &sz, NULL, 0), expected,
|
assert_d_eq(mallctl("stats.resident", (void *)&resident, &sz, NULL, 0),
|
||||||
"Unexpected mallctl() result");
|
expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.resident", &resident, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.mapped", (void *)&mapped, &sz, NULL, 0),
|
||||||
expected, "Unexpected mallctl() result");
|
expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.mapped", &mapped, &sz, NULL, 0), expected,
|
|
||||||
"Unexpected mallctl() result");
|
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_zu_le(allocated, active,
|
assert_zu_le(allocated, active,
|
||||||
@ -38,19 +38,21 @@ TEST_BEGIN(test_stats_large)
|
|||||||
p = mallocx(SMALL_MAXCLASS+1, 0);
|
p = mallocx(SMALL_MAXCLASS+1, 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.allocated", &allocated, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.large.allocated",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&allocated, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.nmalloc", &nmalloc, &sz, NULL,
|
assert_d_eq(mallctl("stats.arenas.0.large.nmalloc", (void *)&nmalloc,
|
||||||
0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.ndalloc", &ndalloc, &sz, NULL,
|
assert_d_eq(mallctl("stats.arenas.0.large.ndalloc", (void *)&ndalloc,
|
||||||
0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.nrequests", &nrequests, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.large.nrequests",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&nrequests, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_zu_gt(allocated, 0,
|
assert_zu_gt(allocated, 0,
|
||||||
@ -76,8 +78,8 @@ TEST_BEGIN(test_stats_arenas_summary)
|
|||||||
uint64_t npurge, nmadvise, purged;
|
uint64_t npurge, nmadvise, purged;
|
||||||
|
|
||||||
arena = 0;
|
arena = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
|
assert_d_eq(mallctl("thread.arena", NULL, NULL, (void *)&arena,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(arena)), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
little = mallocx(SMALL_MAXCLASS, 0);
|
little = mallocx(SMALL_MAXCLASS, 0);
|
||||||
assert_ptr_not_null(little, "Unexpected mallocx() failure");
|
assert_ptr_not_null(little, "Unexpected mallocx() failure");
|
||||||
@ -92,19 +94,19 @@ TEST_BEGIN(test_stats_arenas_summary)
|
|||||||
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
||||||
"Unexpected mallctl() failure");
|
"Unexpected mallctl() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.mapped", &mapped, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.mapped", (void *)&mapped, &sz, NULL,
|
||||||
expected, "Unexepected mallctl() result");
|
0), expected, "Unexepected mallctl() result");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge, &sz, NULL,
|
||||||
expected, "Unexepected mallctl() result");
|
0), expected, "Unexepected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.nmadvise", &nmadvise, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.nmadvise", (void *)&nmadvise, &sz,
|
||||||
expected, "Unexepected mallctl() result");
|
NULL, 0), expected, "Unexepected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.purged", &purged, &sz, NULL, 0),
|
assert_d_eq(mallctl("stats.arenas.0.purged", (void *)&purged, &sz, NULL,
|
||||||
expected, "Unexepected mallctl() result");
|
0), expected, "Unexepected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_u64_gt(npurge, 0,
|
assert_u64_gt(npurge, 0,
|
||||||
@ -142,8 +144,8 @@ TEST_BEGIN(test_stats_arenas_small)
|
|||||||
no_lazy_lock(); /* Lazy locking would dodge tcache testing. */
|
no_lazy_lock(); /* Lazy locking would dodge tcache testing. */
|
||||||
|
|
||||||
arena = 0;
|
arena = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
|
assert_d_eq(mallctl("thread.arena", NULL, NULL, (void *)&arena,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(arena)), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
p = mallocx(SMALL_MAXCLASS, 0);
|
p = mallocx(SMALL_MAXCLASS, 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
@ -151,19 +153,21 @@ TEST_BEGIN(test_stats_arenas_small)
|
|||||||
assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
|
assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
|
||||||
config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
|
config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.small.allocated", &allocated, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.small.allocated",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&allocated, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.small.nmalloc", &nmalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.small.nmalloc", (void *)&nmalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.small.ndalloc", &ndalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.small.ndalloc", (void *)&ndalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.small.nrequests", &nrequests, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.small.nrequests",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&nrequests, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_zu_gt(allocated, 0,
|
assert_zu_gt(allocated, 0,
|
||||||
@ -189,23 +193,24 @@ TEST_BEGIN(test_stats_arenas_large)
|
|||||||
int expected = config_stats ? 0 : ENOENT;
|
int expected = config_stats ? 0 : ENOENT;
|
||||||
|
|
||||||
arena = 0;
|
arena = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
|
assert_d_eq(mallctl("thread.arena", NULL, NULL, (void *)&arena,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(arena)), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
p = mallocx((1U << LG_LARGE_MINCLASS), 0);
|
p = mallocx((1U << LG_LARGE_MINCLASS), 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.allocated", &allocated, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.large.allocated",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&allocated, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.nmalloc", &nmalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.large.nmalloc", (void *)&nmalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.large.ndalloc", &ndalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.large.ndalloc", (void *)&ndalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_zu_gt(allocated, 0,
|
assert_zu_gt(allocated, 0,
|
||||||
@ -230,8 +235,8 @@ TEST_BEGIN(test_stats_arenas_bins)
|
|||||||
int expected = config_stats ? 0 : ENOENT;
|
int expected = config_stats ? 0 : ENOENT;
|
||||||
|
|
||||||
arena = 0;
|
arena = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
|
assert_d_eq(mallctl("thread.arena", NULL, NULL, (void *)&arena,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(arena)), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
p = mallocx(arena_bin_info[0].reg_size, 0);
|
p = mallocx(arena_bin_info[0].reg_size, 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
@ -239,35 +244,36 @@ TEST_BEGIN(test_stats_arenas_bins)
|
|||||||
assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
|
assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
|
||||||
config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
|
config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nmalloc", &nmalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nmalloc", (void *)&nmalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.ndalloc", &ndalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.ndalloc", (void *)&ndalloc,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nrequests", &nrequests, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nrequests",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&nrequests, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.curregs", &curregs, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.curregs", (void *)&curregs,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
|
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nfills", &nfills, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nfills", (void *)&nfills,
|
||||||
NULL, 0), config_tcache ? expected : ENOENT,
|
&sz, NULL, 0), config_tcache ? expected : ENOENT,
|
||||||
"Unexpected mallctl() result");
|
"Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nflushes", &nflushes, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nflushes", (void *)&nflushes,
|
||||||
NULL, 0), config_tcache ? expected : ENOENT,
|
&sz, NULL, 0), config_tcache ? expected : ENOENT,
|
||||||
"Unexpected mallctl() result");
|
"Unexpected mallctl() result");
|
||||||
|
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nslabs", &nslabs, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nslabs", (void *)&nslabs,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.nreslabs", &nreslabs, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.nreslabs", (void *)&nreslabs,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.bins.0.curslabs", &curslabs, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.bins.0.curslabs", (void *)&curslabs,
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
&sz, NULL, 0), expected, "Unexpected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_u64_gt(nmalloc, 0,
|
assert_u64_gt(nmalloc, 0,
|
||||||
@ -303,27 +309,30 @@ TEST_BEGIN(test_stats_arenas_lextents)
|
|||||||
int expected = config_stats ? 0 : ENOENT;
|
int expected = config_stats ? 0 : ENOENT;
|
||||||
|
|
||||||
arena = 0;
|
arena = 0;
|
||||||
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
|
assert_d_eq(mallctl("thread.arena", NULL, NULL, (void *)&arena,
|
||||||
0, "Unexpected mallctl() failure");
|
sizeof(arena)), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("arenas.lextent.0.size", &hsize, &sz, NULL, 0), 0,
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&hsize, &sz, NULL,
|
||||||
"Unexpected mallctl() failure");
|
0), 0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
p = mallocx(hsize, 0);
|
p = mallocx(hsize, 0);
|
||||||
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
||||||
|
|
||||||
assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)),
|
||||||
"Unexpected mallctl() failure");
|
0, "Unexpected mallctl() failure");
|
||||||
|
|
||||||
sz = sizeof(uint64_t);
|
sz = sizeof(uint64_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.lextents.0.nmalloc", &nmalloc, &sz,
|
assert_d_eq(mallctl("stats.arenas.0.lextents.0.nmalloc",
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&nmalloc, &sz, NULL, 0), expected,
|
||||||
assert_d_eq(mallctl("stats.arenas.0.lextents.0.ndalloc", &ndalloc, &sz,
|
"Unexpected mallctl() result");
|
||||||
NULL, 0), expected, "Unexpected mallctl() result");
|
assert_d_eq(mallctl("stats.arenas.0.lextents.0.ndalloc",
|
||||||
|
(void *)&ndalloc, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
sz = sizeof(size_t);
|
sz = sizeof(size_t);
|
||||||
assert_d_eq(mallctl("stats.arenas.0.lextents.0.curlextents",
|
assert_d_eq(mallctl("stats.arenas.0.lextents.0.curlextents",
|
||||||
&curlextents, &sz, NULL, 0), expected, "Unexpected mallctl() result");
|
(void *)&curlextents, &sz, NULL, 0), expected,
|
||||||
|
"Unexpected mallctl() result");
|
||||||
|
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
assert_u64_gt(nmalloc, 0,
|
assert_u64_gt(nmalloc, 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user