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:
@ -15,6 +15,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <stdatomic.h>
|
||||
// Release-silent logging
|
||||
#include "hakmem_internal.h"
|
||||
|
||||
// For madvise (Linux)
|
||||
#ifdef __linux__
|
||||
@ -86,13 +88,10 @@ void hak_batch_init(void) {
|
||||
}
|
||||
|
||||
g_initialized = 1;
|
||||
{
|
||||
const char* q = getenv("HAKMEM_QUIET");
|
||||
if (!(q && strcmp(q, "1") == 0)) {
|
||||
fprintf(stderr, "[Batch] Initialized (threshold=%d MB, min_size=%d KB, bg=%s)\n",
|
||||
BATCH_THRESHOLD / (1024 * 1024), BATCH_MIN_SIZE / 1024, g_bg_enabled?"on":"off");
|
||||
}
|
||||
}
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
fprintf(stderr, "[Batch] Initialized (threshold=%d MB, min_size=%d KB, bg=%s)\n",
|
||||
BATCH_THRESHOLD / (1024 * 1024), BATCH_MIN_SIZE / 1024, g_bg_enabled?"on":"off");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Flush all batched blocks
|
||||
@ -138,13 +137,10 @@ void hak_batch_flush(void) {
|
||||
#endif
|
||||
|
||||
g_flush_count++;
|
||||
{
|
||||
const char* q = getenv("HAKMEM_QUIET");
|
||||
if (!(q && strcmp(q, "1") == 0)) {
|
||||
fprintf(stderr, "[Batch] Flushed %d blocks (%.1f MB) - flush #%lu\n",
|
||||
snap.count, snap.total_bytes / (1024.0 * 1024.0), g_flush_count);
|
||||
}
|
||||
}
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
fprintf(stderr, "[Batch] Flushed %d blocks (%.1f MB) - flush #%lu\n",
|
||||
snap.count, snap.total_bytes / (1024.0 * 1024.0), g_flush_count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Add block to batch
|
||||
@ -203,10 +199,7 @@ void hak_batch_shutdown(void) {
|
||||
} else {
|
||||
// Flush any remaining blocks synchronously
|
||||
if (g_batch.count > 0) {
|
||||
const char* q = getenv("HAKMEM_QUIET");
|
||||
if (!(q && strcmp(q, "1") == 0)) {
|
||||
fprintf(stderr, "[Batch] Final flush of %d remaining blocks...\n", g_batch.count);
|
||||
}
|
||||
fprintf(stderr, "[Batch] Final flush of %d remaining blocks...\n", g_batch.count);
|
||||
hak_batch_flush();
|
||||
}
|
||||
}
|
||||
@ -219,6 +212,7 @@ void hak_batch_shutdown(void) {
|
||||
void hak_batch_print_stats(void) {
|
||||
if (!g_initialized) return;
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
fprintf(stderr, "\n========================================\n");
|
||||
fprintf(stderr, "madvise Batching Statistics\n");
|
||||
fprintf(stderr, "========================================\n");
|
||||
@ -236,6 +230,7 @@ void hak_batch_print_stats(void) {
|
||||
fprintf(stderr, "Pending blocks: %d\n", g_batch.count);
|
||||
fprintf(stderr, "Pending bytes: %.1f MB\n", g_batch.total_bytes / (1024.0 * 1024.0));
|
||||
fprintf(stderr, "========================================\n\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
// Query pending bytes
|
||||
|
||||
Reference in New Issue
Block a user