Priority-2: ENV Cache - Warm Path (FastCache/SuperSlab) getenv() 置換
変更内容: - hakmem_env_cache.h: 2つの新ENV変数を追加 (TINY_FAST_STATS, TINY_UNIFIED_CACHE) - tiny_fastcache.c: 2箇所の getenv() を置換 (TINY_PROFILE, TINY_FAST_STATS) - tiny_fastcache.h: 1箇所の getenv() を置換 (TINY_PROFILE in inline function) - superslab_slab.c: 1箇所の getenv() を置換 (TINY_SLL_DIAG) - tiny_unified_cache.c: 1箇所の getenv() を置換 (TINY_UNIFIED_CACHE) 効果: Warm path層からも syscall を排除 (ENV変数数: 28→30) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include "../superslab/superslab_inline.h" // Phase 23-E: ss_active_add, slab_index_for, ss_slabs_capacity
|
||||
#include "../hakmem_super_registry.h" // For hak_super_lookup (pointer→SuperSlab)
|
||||
#include "../box/pagefault_telemetry_box.h" // Phase 24: Box PageFaultTelemetry (Tiny page touch stats)
|
||||
#include "../hakmem_env_cache.h" // Priority-2: ENV cache (eliminate syscalls)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -37,10 +38,10 @@ __thread uint64_t g_unified_cache_full[TINY_NUM_CLASSES] = {0};
|
||||
|
||||
// Enable flag (default: ON, disable with HAKMEM_TINY_UNIFIED_CACHE=0)
|
||||
int unified_cache_enabled(void) {
|
||||
// Priority-2: Use cached ENV (eliminate lazy-init static overhead)
|
||||
static int g_enable = -1;
|
||||
if (__builtin_expect(g_enable == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_UNIFIED_CACHE");
|
||||
g_enable = (e && *e && *e == '0') ? 0 : 1; // default ON
|
||||
g_enable = HAK_ENV_TINY_UNIFIED_CACHE();
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
if (g_enable) {
|
||||
fprintf(stderr, "[Unified-INIT] unified_cache_enabled() = %d\n", g_enable);
|
||||
|
||||
Reference in New Issue
Block a user