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:
@ -6,8 +6,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h> // For getenv()
|
||||
#include "box/tiny_next_ptr_box.h" // Box API: Next pointer read/write
|
||||
#include <stdlib.h>
|
||||
#include "hakmem_env_cache.h" // Priority-2: ENV cache (eliminate syscalls)
|
||||
#include "box/tiny_next_ptr_box.h" // Box API: Next pointer read/write
|
||||
|
||||
// ========== Configuration ==========
|
||||
|
||||
@ -68,10 +69,10 @@ static inline uint64_t tiny_fast_rdtsc(void) { return 0; }
|
||||
extern int g_profile_enabled;
|
||||
static inline int tiny_fast_profile_enabled(void) {
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
// Priority-2: Use cached ENV (eliminate lazy-init inline overhead)
|
||||
extern int g_profile_enabled;
|
||||
if (__builtin_expect(g_profile_enabled == -1, 0)) {
|
||||
const char* env = getenv("HAKMEM_TINY_PROFILE");
|
||||
g_profile_enabled = (env && *env && *env != '0') ? 1 : 0;
|
||||
g_profile_enabled = HAK_ENV_TINY_PROFILE();
|
||||
}
|
||||
return g_profile_enabled;
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user