Add stage stats dump toggle for shared pool
This commit is contained in:
@ -523,6 +523,28 @@ static SharedSSMeta* sp_meta_find_or_create(SuperSlab* ss) {
|
||||
// Phase 12-1.x: Acquire Helper Boxes (Stage 0.5/1/2/3)
|
||||
// ============================================================================
|
||||
|
||||
// Debug / stats helper (Stage hits)
|
||||
static inline void sp_stage_stats_dump_if_enabled(void) {
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
static int dump_en = -1;
|
||||
if (__builtin_expect(dump_en == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_SHARED_POOL_STAGE_STATS");
|
||||
dump_en = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
if (!dump_en) return;
|
||||
|
||||
// 代表として class0 のカウンタを出す(全クラス合計が欲しければ別途集計)
|
||||
fprintf(stderr,
|
||||
"[SP_STAGE_STATS] c0: stage0.5=%u stage1=%u stage2=%u stage3=%u\n",
|
||||
(unsigned)atomic_load_explicit(&g_sp_stage0_hits[0], memory_order_relaxed),
|
||||
(unsigned)atomic_load_explicit(&g_sp_stage1_hits[0], memory_order_relaxed),
|
||||
(unsigned)atomic_load_explicit(&g_sp_stage2_hits[0], memory_order_relaxed),
|
||||
(unsigned)atomic_load_explicit(&g_sp_stage3_hits[0], memory_order_relaxed));
|
||||
#else
|
||||
(void)g_sp_stage0_hits; (void)g_sp_stage1_hits; (void)g_sp_stage2_hits; (void)g_sp_stage3_hits;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Stage 0.5: EMPTY slab direct scan(registry ベースの EMPTY 再利用)
|
||||
static inline int
|
||||
sp_acquire_from_empty_scan(int class_idx, SuperSlab** ss_out, int* slab_idx_out, int dbg_acquire)
|
||||
|
||||
Reference in New Issue
Block a user