mirror of
https://github.com/matrix-construct/construct
synced 2024-06-10 22:18:54 +02:00
ircd::db: Move allocator log debug to separate define; use constexpr.
This commit is contained in:
parent
5e3ae3771d
commit
305c6e8075
|
@ -26,6 +26,7 @@
|
||||||
#define RB_DEBUG_DB_PREFETCH 0
|
#define RB_DEBUG_DB_PREFETCH 0
|
||||||
#define RB_DEBUG_DB_CACHE 0
|
#define RB_DEBUG_DB_CACHE 0
|
||||||
#define RB_DEBUG_DB_CACHE_HIT 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
|
/// Set this #define to 1 or 2 to enable extensive log messages for the
|
||||||
/// experimental db environment-port implementation. This is only useful
|
/// experimental db environment-port implementation. This is only useful
|
||||||
|
|
|
@ -142,9 +142,9 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*their_cache_arena_hooks);
|
const auto &their_hooks(*their_cache_arena_hooks);
|
||||||
|
|
||||||
#ifdef RB_DEBUG_DB_ENV
|
|
||||||
assert(zero);
|
assert(zero);
|
||||||
assert(commit);
|
assert(commit);
|
||||||
|
if constexpr(RB_DEBUG_DB_ALLOCATOR)
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u alloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
log, "cache arena:%u alloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
||||||
|
@ -156,7 +156,6 @@ noexcept
|
||||||
*commit,
|
*commit,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
void *const ret
|
void *const ret
|
||||||
{
|
{
|
||||||
|
@ -189,7 +188,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u dalloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
log, "cache arena:%u dalloc addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
||||||
|
@ -199,7 +198,6 @@ noexcept
|
||||||
committed,
|
committed,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
const bool ret
|
const bool ret
|
||||||
{
|
{
|
||||||
|
@ -231,7 +229,8 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u destroy addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
log, "cache arena:%u destroy addr:%p size:%zu align:%zu z:%b c:%b ind:%u",
|
||||||
|
@ -241,7 +240,6 @@ noexcept
|
||||||
committed,
|
committed,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_MLOCK2)
|
#if defined(HAVE_MLOCK2)
|
||||||
if(database::allocator::mlock_current)
|
if(database::allocator::mlock_current)
|
||||||
|
@ -269,7 +267,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u commit addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
log, "cache arena:%u commit addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
||||||
|
@ -280,7 +278,6 @@ noexcept
|
||||||
length,
|
length,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.commit(hooks, ptr, size, offset, length, arena_ind);
|
return their_hooks.commit(hooks, ptr, size, offset, length, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +296,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u decommit addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
log, "cache arena:%u decommit addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
||||||
|
@ -310,7 +307,6 @@ noexcept
|
||||||
length,
|
length,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.decommit(hooks, ptr, size, offset, length, arena_ind);
|
return their_hooks.decommit(hooks, ptr, size, offset, length, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -329,7 +325,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u purge lazy addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
log, "cache arena:%u purge lazy addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
||||||
|
@ -340,7 +336,6 @@ noexcept
|
||||||
length,
|
length,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.purge_lazy(hooks, ptr, size, offset, length, arena_ind);
|
return their_hooks.purge_lazy(hooks, ptr, size, offset, length, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +354,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u purge forced addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
log, "cache arena:%u purge forced addr:%p size:%zu offset:%zu length:%zu ind:%u",
|
||||||
|
@ -370,7 +365,6 @@ noexcept
|
||||||
length,
|
length,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.purge_forced(hooks, ptr, size, offset, length, arena_ind);
|
return their_hooks.purge_forced(hooks, ptr, size, offset, length, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -390,7 +384,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u split addr:%p size:%zu size_a:%zu size_b:%zu committed:%b ind:%u",
|
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,
|
committed,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.split(hooks, ptr, size, size_a, size_b, committed, arena_ind);
|
return their_hooks.split(hooks, ptr, size, size_a, size_b, committed, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +415,7 @@ noexcept
|
||||||
assert(their_cache_arena_hooks);
|
assert(their_cache_arena_hooks);
|
||||||
const auto &their_hooks(*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::debug
|
||||||
{
|
{
|
||||||
log, "cache arena:%u merge a[addr:%p size:%zu] b[addr:%p size:%zu] committed:%b ind:%u",
|
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,
|
committed,
|
||||||
arena_ind,
|
arena_ind,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return their_hooks.merge(hooks, addr_a, size_a, addr_b, size_b, committed, arena_ind);
|
return their_hooks.merge(hooks, addr_a, size_a, addr_b, size_b, committed, arena_ind);
|
||||||
}
|
}
|
||||||
|
@ -521,8 +513,8 @@ noexcept
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef RB_DEBUG_DB_ENV
|
|
||||||
assert(d);
|
assert(d);
|
||||||
|
if constexpr(RB_DEBUG_DB_ALLOCATOR)
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
log, "[%s]'%s' allocate:%zu alignment:%zu %p",
|
log, "[%s]'%s' allocate:%zu alignment:%zu %p",
|
||||||
|
@ -532,7 +524,6 @@ noexcept
|
||||||
alignment,
|
alignment,
|
||||||
ptr,
|
ptr,
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue