2016-02-20 12:09:31 +08:00
|
|
|
#include "test/jemalloc_test.h"
|
|
|
|
|
2016-10-13 01:40:27 +08:00
|
|
|
const char *malloc_conf = "decay_time:1,lg_tcache_max:0";
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-10-11 13:15:10 +08:00
|
|
|
static nstime_monotonic_t *nstime_monotonic_orig;
|
2016-02-22 03:25:02 +08:00
|
|
|
static nstime_update_t *nstime_update_orig;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
static unsigned nupdates_mock;
|
2016-02-22 03:25:02 +08:00
|
|
|
static nstime_t time_mock;
|
2016-10-12 06:28:43 +08:00
|
|
|
static bool monotonic_mock;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-10-11 13:15:10 +08:00
|
|
|
static bool
|
|
|
|
nstime_monotonic_mock(void)
|
|
|
|
{
|
|
|
|
|
2016-10-12 06:28:43 +08:00
|
|
|
return (monotonic_mock);
|
2016-10-11 13:15:10 +08:00
|
|
|
}
|
|
|
|
|
2016-02-20 12:09:31 +08:00
|
|
|
static bool
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update_mock(nstime_t *time)
|
2016-02-20 12:09:31 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
nupdates_mock++;
|
2016-10-12 06:28:43 +08:00
|
|
|
if (monotonic_mock)
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_copy(time, &time_mock);
|
2016-10-12 06:28:43 +08:00
|
|
|
return (!monotonic_mock);
|
2016-02-20 12:09:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_BEGIN(test_decay_ticks)
|
|
|
|
{
|
|
|
|
ticker_t *decay_ticker;
|
|
|
|
unsigned tick0, tick1;
|
2016-06-01 05:50:21 +08:00
|
|
|
size_t sz, large0;
|
2016-02-20 12:09:31 +08:00
|
|
|
void *p;
|
|
|
|
|
|
|
|
decay_ticker = decay_ticker_get(tsd_fetch(), 0);
|
|
|
|
assert_ptr_not_null(decay_ticker,
|
|
|
|
"Unexpected failure getting decay ticker");
|
|
|
|
|
|
|
|
sz = sizeof(size_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&large0, &sz, NULL,
|
|
|
|
0), 0, "Unexpected mallctl failure");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-02-21 01:02:49 +08:00
|
|
|
/*
|
2016-06-01 05:50:21 +08:00
|
|
|
* Test the standard APIs using a large size class, since we can't
|
2016-05-28 15:17:28 +08:00
|
|
|
* control tcache interactions for small size classes (except by
|
|
|
|
* completely disabling tcache for the entire test program).
|
2016-02-21 01:02:49 +08:00
|
|
|
*/
|
|
|
|
|
2016-02-20 12:09:31 +08:00
|
|
|
/* malloc(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
p = malloc(large0);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(p, "Unexpected malloc() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during malloc()");
|
|
|
|
/* free(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
free(p);
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during free()");
|
|
|
|
|
|
|
|
/* calloc(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
p = calloc(1, large0);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(p, "Unexpected calloc() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during calloc()");
|
|
|
|
free(p);
|
|
|
|
|
|
|
|
/* posix_memalign(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
assert_d_eq(posix_memalign(&p, sizeof(size_t), large0), 0,
|
2016-02-20 12:09:31 +08:00
|
|
|
"Unexpected posix_memalign() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during posix_memalign()");
|
|
|
|
free(p);
|
|
|
|
|
|
|
|
/* aligned_alloc(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
p = aligned_alloc(sizeof(size_t), large0);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(p, "Unexpected aligned_alloc() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during aligned_alloc()");
|
|
|
|
free(p);
|
|
|
|
|
|
|
|
/* realloc(). */
|
|
|
|
/* Allocate. */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
p = realloc(NULL, large0);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(p, "Unexpected realloc() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
|
|
|
|
/* Reallocate. */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
2016-06-01 05:50:21 +08:00
|
|
|
p = realloc(p, large0);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(p, "Unexpected realloc() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
|
|
|
|
/* Deallocate. */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
realloc(p, 0);
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
|
|
|
|
|
2016-02-21 01:02:49 +08:00
|
|
|
/*
|
2016-06-01 05:50:21 +08:00
|
|
|
* Test the *allocx() APIs using large and small size classes, with
|
2016-05-28 15:17:28 +08:00
|
|
|
* tcache explicitly disabled.
|
2016-02-21 01:02:49 +08:00
|
|
|
*/
|
|
|
|
{
|
|
|
|
unsigned i;
|
2016-05-28 15:17:28 +08:00
|
|
|
size_t allocx_sizes[2];
|
2016-06-01 05:50:21 +08:00
|
|
|
allocx_sizes[0] = large0;
|
2016-05-28 15:17:28 +08:00
|
|
|
allocx_sizes[1] = 1;
|
2016-02-21 01:02:49 +08:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof(allocx_sizes) / sizeof(size_t); i++) {
|
|
|
|
sz = allocx_sizes[i];
|
|
|
|
|
|
|
|
/* mallocx(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
p = mallocx(sz, MALLOCX_TCACHE_NONE);
|
|
|
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during mallocx() (sz=%zu)",
|
|
|
|
sz);
|
|
|
|
/* rallocx(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
p = rallocx(p, sz, MALLOCX_TCACHE_NONE);
|
|
|
|
assert_ptr_not_null(p, "Unexpected rallocx() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during rallocx() (sz=%zu)",
|
|
|
|
sz);
|
|
|
|
/* xallocx(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
xallocx(p, sz, 0, MALLOCX_TCACHE_NONE);
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during xallocx() (sz=%zu)",
|
|
|
|
sz);
|
|
|
|
/* dallocx(). */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
dallocx(p, MALLOCX_TCACHE_NONE);
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during dallocx() (sz=%zu)",
|
|
|
|
sz);
|
|
|
|
/* sdallocx(). */
|
|
|
|
p = mallocx(sz, MALLOCX_TCACHE_NONE);
|
|
|
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
sdallocx(p, sz, MALLOCX_TCACHE_NONE);
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during sdallocx() "
|
|
|
|
"(sz=%zu)", sz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-06-01 05:50:21 +08:00
|
|
|
* Test tcache fill/flush interactions for large and small size classes,
|
2016-02-21 01:02:49 +08:00
|
|
|
* using an explicit tcache.
|
|
|
|
*/
|
2016-02-28 15:40:31 +08:00
|
|
|
if (config_tcache) {
|
2016-02-21 01:02:49 +08:00
|
|
|
unsigned tcache_ind, i;
|
|
|
|
size_t tcache_sizes[2];
|
2016-06-01 05:50:21 +08:00
|
|
|
tcache_sizes[0] = large0;
|
2016-02-21 01:02:49 +08:00
|
|
|
tcache_sizes[1] = 1;
|
|
|
|
|
|
|
|
sz = sizeof(unsigned);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("tcache.create", (void *)&tcache_ind, &sz,
|
|
|
|
NULL, 0), 0, "Unexpected mallctl failure");
|
2016-02-21 01:02:49 +08:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof(tcache_sizes) / sizeof(size_t); i++) {
|
|
|
|
sz = tcache_sizes[i];
|
|
|
|
|
|
|
|
/* tcache fill. */
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
p = mallocx(sz, MALLOCX_TCACHE(tcache_ind));
|
|
|
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during tcache fill "
|
|
|
|
"(sz=%zu)", sz);
|
|
|
|
/* tcache flush. */
|
|
|
|
dallocx(p, MALLOCX_TCACHE(tcache_ind));
|
|
|
|
tick0 = ticker_read(decay_ticker);
|
|
|
|
assert_d_eq(mallctl("tcache.flush", NULL, NULL,
|
2016-10-28 12:31:25 +08:00
|
|
|
(void *)&tcache_ind, sizeof(unsigned)), 0,
|
2016-02-21 01:02:49 +08:00
|
|
|
"Unexpected mallctl failure");
|
|
|
|
tick1 = ticker_read(decay_ticker);
|
|
|
|
assert_u32_ne(tick1, tick0,
|
|
|
|
"Expected ticker to tick during tcache flush "
|
|
|
|
"(sz=%zu)", sz);
|
|
|
|
}
|
|
|
|
}
|
2016-02-20 12:09:31 +08:00
|
|
|
}
|
|
|
|
TEST_END
|
|
|
|
|
|
|
|
TEST_BEGIN(test_decay_ticker)
|
|
|
|
{
|
|
|
|
#define NPS 1024
|
|
|
|
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
|
|
|
void *ps[NPS];
|
2016-02-28 12:38:29 +08:00
|
|
|
uint64_t epoch;
|
|
|
|
uint64_t npurge0 = 0;
|
|
|
|
uint64_t npurge1 = 0;
|
2016-06-01 05:50:21 +08:00
|
|
|
size_t sz, large;
|
2016-02-20 12:09:31 +08:00
|
|
|
unsigned i, nupdates0;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_t time, decay_time, deadline;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
/*
|
2016-06-01 05:50:21 +08:00
|
|
|
* Allocate a bunch of large objects, pause the clock, deallocate the
|
2016-02-20 12:09:31 +08:00
|
|
|
* objects, restore the clock, then [md]allocx() in a tight loop to
|
|
|
|
* verify the ticker triggers purging.
|
|
|
|
*/
|
|
|
|
|
2016-02-28 15:40:31 +08:00
|
|
|
if (config_tcache) {
|
|
|
|
size_t tcache_max;
|
|
|
|
|
|
|
|
sz = sizeof(size_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("arenas.tcache_max", (void *)&tcache_max,
|
|
|
|
&sz, NULL, 0), 0, "Unexpected mallctl failure");
|
2016-06-01 05:50:21 +08:00
|
|
|
large = nallocx(tcache_max + 1, flags);
|
2016-02-28 15:40:31 +08:00
|
|
|
} else {
|
|
|
|
sz = sizeof(size_t);
|
2016-06-01 05:50:21 +08:00
|
|
|
assert_d_eq(mallctl("arenas.lextent.0.size", &large, &sz, NULL,
|
2016-05-28 15:17:28 +08:00
|
|
|
0), 0, "Unexpected mallctl failure");
|
2016-02-28 15:40:31 +08:00
|
|
|
}
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
|
|
|
"Unexpected mallctl failure");
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
|
|
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
2016-02-20 12:09:31 +08:00
|
|
|
sz = sizeof(uint64_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge0, &sz,
|
|
|
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
for (i = 0; i < NPS; i++) {
|
2016-06-01 05:50:21 +08:00
|
|
|
ps[i] = mallocx(large, flags);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(ps[i], "Unexpected mallocx() failure");
|
|
|
|
}
|
|
|
|
|
|
|
|
nupdates_mock = 0;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_init(&time_mock, 0);
|
|
|
|
nstime_update(&time_mock);
|
2016-10-12 06:28:43 +08:00
|
|
|
monotonic_mock = true;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-10-12 06:28:43 +08:00
|
|
|
nstime_monotonic_orig = nstime_monotonic;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update_orig = nstime_update;
|
2016-10-12 06:28:43 +08:00
|
|
|
nstime_monotonic = nstime_monotonic_mock;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update = nstime_update_mock;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
for (i = 0; i < NPS; i++) {
|
|
|
|
dallocx(ps[i], flags);
|
|
|
|
nupdates0 = nupdates_mock;
|
|
|
|
assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
|
|
|
|
"Unexpected arena.0.decay failure");
|
|
|
|
assert_u_gt(nupdates_mock, nupdates0,
|
2016-02-22 03:25:02 +08:00
|
|
|
"Expected nstime_update() to be called");
|
2016-02-20 12:09:31 +08:00
|
|
|
}
|
|
|
|
|
2016-10-12 06:28:43 +08:00
|
|
|
nstime_monotonic = nstime_monotonic_orig;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update = nstime_update_orig;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_init(&time, 0);
|
|
|
|
nstime_update(&time);
|
|
|
|
nstime_init2(&decay_time, opt_decay_time, 0);
|
|
|
|
nstime_copy(&deadline, &time);
|
|
|
|
nstime_add(&deadline, &decay_time);
|
2016-02-20 12:09:31 +08:00
|
|
|
do {
|
|
|
|
for (i = 0; i < DECAY_NTICKS_PER_UPDATE / 2; i++) {
|
|
|
|
void *p = mallocx(1, flags);
|
|
|
|
assert_ptr_not_null(p, "Unexpected mallocx() failure");
|
|
|
|
dallocx(p, flags);
|
|
|
|
}
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
2016-02-20 12:09:31 +08:00
|
|
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
|
|
|
sz = sizeof(uint64_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge1,
|
|
|
|
&sz, NULL, 0), config_stats ? 0 : ENOENT,
|
2016-02-28 12:38:29 +08:00
|
|
|
"Unexpected mallctl result");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update(&time);
|
|
|
|
} while (nstime_compare(&time, &deadline) <= 0 && npurge1 == npurge0);
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-02-28 12:38:29 +08:00
|
|
|
if (config_stats)
|
|
|
|
assert_u64_gt(npurge1, npurge0, "Expected purging to occur");
|
2016-02-20 12:09:31 +08:00
|
|
|
#undef NPS
|
|
|
|
}
|
|
|
|
TEST_END
|
|
|
|
|
|
|
|
TEST_BEGIN(test_decay_nonmonotonic)
|
|
|
|
{
|
|
|
|
#define NPS (SMOOTHSTEP_NSTEPS + 1)
|
|
|
|
int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
|
|
|
|
void *ps[NPS];
|
2016-02-28 12:38:29 +08:00
|
|
|
uint64_t epoch;
|
|
|
|
uint64_t npurge0 = 0;
|
|
|
|
uint64_t npurge1 = 0;
|
2016-06-01 05:50:21 +08:00
|
|
|
size_t sz, large0;
|
2016-02-20 12:09:31 +08:00
|
|
|
unsigned i, nupdates0;
|
|
|
|
|
|
|
|
sz = sizeof(size_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("arenas.lextent.0.size", (void *)&large0, &sz, NULL,
|
|
|
|
0), 0, "Unexpected mallctl failure");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
|
|
|
|
"Unexpected mallctl failure");
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
|
|
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
2016-02-20 12:09:31 +08:00
|
|
|
sz = sizeof(uint64_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge0, &sz,
|
|
|
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
nupdates_mock = 0;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_init(&time_mock, 0);
|
|
|
|
nstime_update(&time_mock);
|
2016-10-12 06:28:43 +08:00
|
|
|
monotonic_mock = false;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-10-11 13:15:10 +08:00
|
|
|
nstime_monotonic_orig = nstime_monotonic;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update_orig = nstime_update;
|
2016-10-11 13:15:10 +08:00
|
|
|
nstime_monotonic = nstime_monotonic_mock;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update = nstime_update_mock;
|
2016-02-20 12:09:31 +08:00
|
|
|
|
|
|
|
for (i = 0; i < NPS; i++) {
|
2016-06-01 05:50:21 +08:00
|
|
|
ps[i] = mallocx(large0, flags);
|
2016-02-20 12:09:31 +08:00
|
|
|
assert_ptr_not_null(ps[i], "Unexpected mallocx() failure");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < NPS; i++) {
|
|
|
|
dallocx(ps[i], flags);
|
|
|
|
nupdates0 = nupdates_mock;
|
|
|
|
assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
|
|
|
|
"Unexpected arena.0.decay failure");
|
|
|
|
assert_u_gt(nupdates_mock, nupdates0,
|
2016-02-22 03:25:02 +08:00
|
|
|
"Expected nstime_update() to be called");
|
2016-02-20 12:09:31 +08:00
|
|
|
}
|
|
|
|
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch,
|
|
|
|
sizeof(uint64_t)), 0, "Unexpected mallctl failure");
|
2016-02-20 12:09:31 +08:00
|
|
|
sz = sizeof(uint64_t);
|
2016-10-28 12:31:25 +08:00
|
|
|
assert_d_eq(mallctl("stats.arenas.0.npurge", (void *)&npurge1, &sz,
|
|
|
|
NULL, 0), config_stats ? 0 : ENOENT, "Unexpected mallctl result");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-02-28 12:38:29 +08:00
|
|
|
if (config_stats)
|
2016-10-11 13:15:10 +08:00
|
|
|
assert_u64_eq(npurge0, npurge1, "Unexpected purging occurred");
|
2016-02-20 12:09:31 +08:00
|
|
|
|
2016-10-11 13:15:10 +08:00
|
|
|
nstime_monotonic = nstime_monotonic_orig;
|
2016-02-22 03:25:02 +08:00
|
|
|
nstime_update = nstime_update_orig;
|
2016-02-20 12:09:31 +08:00
|
|
|
#undef NPS
|
|
|
|
}
|
|
|
|
TEST_END
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
return (test(
|
|
|
|
test_decay_ticks,
|
|
|
|
test_decay_ticker,
|
|
|
|
test_decay_nonmonotonic));
|
|
|
|
}
|