release: silence runtime logs and stabilize benches

- Fix HAKMEM_LOG gating to use  (numeric) so release builds compile out logs.
- Switch remaining prints to HAKMEM_LOG or guard with :
  - core/box/hak_core_init.inc.h (EVO sample warning, shutdown banner)
  - core/hakmem_config.c (config/feature prints)
  - core/hakmem.c (BigCache eviction prints)
  - core/hakmem_tiny_superslab.c (OOM, head init/expand, C7 init diagnostics)
  - core/hakmem_elo.c (init/evolution)
  - core/hakmem_batch.c (init/flush/stats)
  - core/hakmem_ace.c (33KB route diagnostics)
  - core/hakmem_ace_controller.c (ACE logs macro → no-op in release)
  - core/hakmem_site_rules.c (init banner)
  - core/box/hak_free_api.inc.h (unknown method error → release-gated)
- Rebuilt benches and verified quiet output for release:
  - bench_fixed_size_hakmem/system
  - bench_random_mixed_hakmem/system
  - bench_mid_large_mt_hakmem/system
  - bench_comprehensive_hakmem/system

Note: Kept debug logs available in debug builds and when explicitly toggled via env.
This commit is contained in:
Moe Charm (CI)
2025-11-11 01:47:06 +09:00
parent a97005f50e
commit 8feeb63c2b
25 changed files with 215 additions and 144 deletions

View File

@ -5,7 +5,7 @@
// Thread-safe initialization using pthread_once
static pthread_once_t hak_pool_init_once_control = PTHREAD_ONCE_INIT;
static void hak_pool_init_impl(void) {
fprintf(stderr, "[Pool] hak_pool_init_impl() EXECUTING - Bridge class fix applied\n");
HAKMEM_LOG("[Pool] hak_pool_init_impl() EXECUTING - Bridge class fix applied\n");
const FrozenPolicy* pol = hkm_policy_get();
// Phase 6.21 CRITICAL FIX: Bridge classes are hardcoded in g_class_sizes,
@ -91,9 +91,9 @@ static void hak_pool_init_impl(void) {
HAKMEM_LOG("[MF2] max_queues=%d, lease_ms=%d, idle_threshold_us=%d\n", g_mf2_max_queues, g_mf2_lease_ms, g_mf2_idle_threshold_us);
}
g_pool.initialized = 1;
fprintf(stderr, "[Pool] Initialized (L2 Hybrid Pool) - Bridge classes SHOULD be enabled\n");
fprintf(stderr, "[Pool] Class 5 (40KB): %zu\n", g_class_sizes[5]);
fprintf(stderr, "[Pool] Class 6 (52KB): %zu\n", g_class_sizes[6]);
HAKMEM_LOG("[Pool] Initialized (L2 Hybrid Pool) - Bridge classes SHOULD be enabled\n");
HAKMEM_LOG("[Pool] Class 5 (40KB): %zu\n", g_class_sizes[5]);
HAKMEM_LOG("[Pool] Class 6 (52KB): %zu\n", g_class_sizes[6]);
HAKMEM_LOG("[Pool] Initialized (L2 Hybrid Pool)\n");
#ifdef HAKMEM_DEBUG_VERBOSE
@ -123,10 +123,10 @@ static void hak_pool_init_impl(void) {
allocated++;
}
}
fprintf(stderr, "[Pool] Pre-allocated %d pages for Bridge class 5 (%zu KB) - Critical for 33KB allocs\n",
HAKMEM_LOG("[Pool] Pre-allocated %d pages for Bridge class 5 (%zu KB) - Critical for 33KB allocs\n",
allocated, g_class_sizes[5]/1024);
} else {
fprintf(stderr, "[Pool] WARNING: Bridge class 5 (40KB) is DISABLED - 33KB allocations will fail!\n");
HAKMEM_LOG("[Pool] WARNING: Bridge class 5 (40KB) is DISABLED - 33KB allocations will fail!\n");
}
// Pre-warm Bridge class 6 (52KB)
@ -137,17 +137,14 @@ static void hak_pool_init_impl(void) {
allocated++;
}
}
fprintf(stderr, "[Pool] Pre-allocated %d pages for Bridge class 6 (%zu KB)\n",
HAKMEM_LOG("[Pool] Pre-allocated %d pages for Bridge class 6 (%zu KB)\n",
allocated, g_class_sizes[6]/1024);
}
}
void hak_pool_init(void) {
// Always print this to see if it's being called
static int called = 0;
if (called++ == 0) {
fprintf(stderr, "[Pool] hak_pool_init() called for the first time\n");
}
// Debug-only trace
// static int called = 0; if (called++ == 0) { HAKMEM_LOG("[Pool] hak_pool_init() called for the first time\n"); }
pthread_once(&hak_pool_init_once_control, hak_pool_init_impl);
}