ENV Cleanup Step 11: Gate HAKMEM_SS_PREWARM_DEBUG in super_registry.c
Gate HAKMEM_SS_PREWARM_DEBUG environment variable behind #if !HAKMEM_BUILD_RELEASE in prewarm functions (2 call sites). Changes: - Wrap dbg variable in hak_ss_prewarm_class() - Wrap dbg variable in hak_ss_prewarm_init() - Release builds use constant dbg = 0 for complete code elimination Performance: 30.2M ops/s Larson (stable, within expected variance) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -562,12 +562,16 @@ void hak_ss_prewarm_class(int size_class, uint32_t count) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
// Debug logging flag (lazy init)
|
// Debug logging flag (lazy init)
|
||||||
static int dbg = -1;
|
static int dbg = -1;
|
||||||
if (__builtin_expect(dbg == -1, 0)) {
|
if (__builtin_expect(dbg == -1, 0)) {
|
||||||
const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG");
|
const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG");
|
||||||
dbg = (e && *e && *e != '0') ? 1 : 0;
|
dbg = (e && *e && *e != '0') ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static const int dbg = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Ensure LRU cache is initialized
|
// Ensure LRU cache is initialized
|
||||||
if (!g_ss_lru_initialized) {
|
if (!g_ss_lru_initialized) {
|
||||||
@ -641,12 +645,16 @@ void hak_ss_prewarm_all(const uint32_t counts[TINY_NUM_CLASSES]) {
|
|||||||
|
|
||||||
// Prewarm: Allocate SuperSlabs at startup and add to LRU cache
|
// Prewarm: Allocate SuperSlabs at startup and add to LRU cache
|
||||||
void hak_ss_prewarm_init(void) {
|
void hak_ss_prewarm_init(void) {
|
||||||
|
#if !HAKMEM_BUILD_RELEASE
|
||||||
// Debug logging flag (lazy init)
|
// Debug logging flag (lazy init)
|
||||||
static int dbg = -1;
|
static int dbg = -1;
|
||||||
if (__builtin_expect(dbg == -1, 0)) {
|
if (__builtin_expect(dbg == -1, 0)) {
|
||||||
const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG");
|
const char* e = getenv("HAKMEM_SS_PREWARM_DEBUG");
|
||||||
dbg = (e && *e && *e != '0') ? 1 : 0;
|
dbg = (e && *e && *e != '0') ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static const int dbg = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Parse environment variable
|
// Parse environment variable
|
||||||
const char* env = getenv("HAKMEM_PREWARM_SUPERSLABS");
|
const char* env = getenv("HAKMEM_PREWARM_SUPERSLABS");
|
||||||
|
|||||||
Reference in New Issue
Block a user