0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-19 11:23:45 +02:00

ircd::db: Move allocator log debug to separate define; use constexpr.

This commit is contained in:
Jason Volk 2022-07-11 14:47:34 -07:00
parent 5e3ae3771d
commit 305c6e8075
2 changed files with 112 additions and 120 deletions

View file

@ -26,6 +26,7 @@
#define RB_DEBUG_DB_PREFETCH 0
#define RB_DEBUG_DB_CACHE 0
#define RB_DEBUG_DB_CACHE_HIT 0
#define RB_DEBUG_DB_ALLOCATOR 0
/// Set this #define to 1 or 2 to enable extensive log messages for the
/// experimental db environment-port implementation. This is only useful

View file

@ -142,9 +142,9 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
assert(zero);
assert(commit);
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u alloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
@ -156,7 +156,6 @@ noexcept
*commit,
arena_ind,
};
#endif
void *const ret
{
@ -189,7 +188,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u dalloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
@ -199,7 +198,6 @@ noexcept
committed,
arena_ind,
};
#endif
const bool ret
{
@ -231,7 +229,8 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u destroy addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
@ -241,7 +240,6 @@ noexcept
committed,
arena_ind,
};
#endif
#if defined(HAVE_MLOCK2)
if(database::allocator::mlock_current)
@ -269,7 +267,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u commit addr:%p size:%zu offset:%zu length:%zu ind:%u",
@ -280,7 +278,6 @@ noexcept
length,
arena_ind,
};
#endif
return their_hooks.commit(hooks, ptr, size, offset, length, arena_ind);
}
@ -299,7 +296,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u decommit addr:%p size:%zu offset:%zu length:%zu ind:%u",
@ -310,7 +307,6 @@ noexcept
length,
arena_ind,
};
#endif
return their_hooks.decommit(hooks, ptr, size, offset, length, arena_ind);
}
@ -329,7 +325,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u purge lazy addr:%p size:%zu offset:%zu length:%zu ind:%u",
@ -340,7 +336,6 @@ noexcept
length,
arena_ind,
};
#endif
return their_hooks.purge_lazy(hooks, ptr, size, offset, length, arena_ind);
}
@ -359,7 +354,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u purge forced addr:%p size:%zu offset:%zu length:%zu ind:%u",
@ -370,7 +365,6 @@ noexcept
length,
arena_ind,
};
#endif
return their_hooks.purge_forced(hooks, ptr, size, offset, length, arena_ind);
}
@ -390,7 +384,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u split addr:%p size:%zu size_a:%zu size_b:%zu committed:%b ind:%u",
@ -402,7 +396,6 @@ noexcept
committed,
arena_ind,
};
#endif
return their_hooks.split(hooks, ptr, size, size_a, size_b, committed, arena_ind);
}
@ -422,7 +415,7 @@ noexcept
assert(their_cache_arena_hooks);
const auto &their_hooks(*their_cache_arena_hooks);
#ifdef RB_DEBUG_DB_ENV
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "cache arena:%u merge a[addr:%p size:%zu] b[addr:%p size:%zu] committed:%b ind:%u",
@ -434,7 +427,6 @@ noexcept
committed,
arena_ind,
};
#endif
return their_hooks.merge(hooks, addr_a, size_a, addr_b, size_b, committed, arena_ind);
}
@ -521,8 +513,8 @@ noexcept
#endif
};
#ifdef RB_DEBUG_DB_ENV
assert(d);
if constexpr(RB_DEBUG_DB_ALLOCATOR)
log::debug
{
log, "[%s]'%s' allocate:%zu alignment:%zu %p",
@ -532,7 +524,6 @@ noexcept
alignment,
ptr,
};
#endif
return ptr;
}