Priority-2 ENV Cache: hakmem_debug.c (1変数追加、1箇所置換)
【追加ENV変数】
- HAKMEM_TIMING (default: 0)
【置換ファイル】
- core/hakmem_debug.c (1箇所 → ENV Cache)
【変更詳細】
1. ENV Cache (hakmem_env_cache.h):
- 構造体に1変数追加 (47→48変数)
- hakmem_env_cache_init()に初期化追加
- アクセサマクロ追加
- カウント更新: 47→48
2. hakmem_debug.c:
- hkm_timing_init():
getenv("HAKMEM_TIMING") + strcmp() → HAK_ENV_TIMING_ENABLED()
- #include "hakmem_env_cache.h" 追加
【効果】
- デバッグタイミング初期化からgetenv()呼び出しを排除
- Cold pathだが、起動時のENV参照を削減
【テスト】
✅ make shared → 成功
✅ /tmp/test_mixed3_final → PASSED
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
// Date: 2025-10-21
|
||||
|
||||
#include "hakmem_debug.h"
|
||||
#include "hakmem_env_cache.h" // Priority-2: ENV cache
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -150,11 +151,8 @@ void hkm_timing_init(void) {
|
||||
if (g_initialized) return;
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
// Check HAKMEM_TIMING environment variable (gated behind !HAKMEM_BUILD_RELEASE)
|
||||
const char* env = getenv("HAKMEM_TIMING");
|
||||
if (env && strcmp(env, "1") == 0) {
|
||||
g_timing_enabled = 1;
|
||||
}
|
||||
// Priority-2: Use cached ENV (gated behind !HAKMEM_BUILD_RELEASE)
|
||||
g_timing_enabled = HAK_ENV_TIMING_ENABLED();
|
||||
#else
|
||||
g_timing_enabled = 0; // Always disabled in release builds
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user