mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-19 15:17:17 +03:00
Refactor deferral constants into corresponding headers.
Currently there are deferral-relevant constants in arena.c and background_thread.c. This commit moves them out into corresponding PAC and HPA headers. Those commonly needed by both are put into a new header deferral.h where the contract of deferral are clearly stated.
This commit is contained in:
parent
916d6081ee
commit
22741cfd8c
11 changed files with 65 additions and 31 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
#include "jemalloc/internal/deferral.h"
|
||||
#include "jemalloc/internal/hpa.h"
|
||||
#include "jemalloc/internal/nstime.h"
|
||||
|
||||
|
|
@ -1131,14 +1132,14 @@ TEST_BEGIN(test_deferred_until_time) {
|
|||
/* Current time = 900ms, purge_eligible at 1300ms */
|
||||
nstime_init(&defer_curtime, 900UL * 1000 * 1000);
|
||||
uint64_t until_ns = hpa_time_until_deferred_work(tsdn, shard);
|
||||
expect_u64_eq(until_ns, BACKGROUND_THREAD_DEFERRED_MIN,
|
||||
expect_u64_eq(until_ns, DEFERRED_WORK_MIN,
|
||||
"First pass did not happen");
|
||||
|
||||
/* Fake that first pass happened more than min_purge_interval_ago */
|
||||
nstime_init(&shard->last_purge, 350UL * 1000 * 1000);
|
||||
shard->stats.npurge_passes = 1;
|
||||
until_ns = hpa_time_until_deferred_work(tsdn, shard);
|
||||
expect_u64_eq(until_ns, BACKGROUND_THREAD_DEFERRED_MIN,
|
||||
expect_u64_eq(until_ns, DEFERRED_WORK_MIN,
|
||||
"No need to heck anything it is more than interval");
|
||||
|
||||
nstime_init(&shard->last_purge, 900UL * 1000 * 1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue