Phase 4d: Add master stats control (HAKMEM_STATS)
Add unified stats/dump control that allows enabling specific stats modules using comma-separated values or "all" to enable everything. New file: core/hakmem_stats_master.h - HAKMEM_STATS=all: Enable all stats modules - HAKMEM_STATS=sfc,fast,pool: Enable specific modules - HAKMEM_STATS_DUMP=1: Dump stats at exit - hak_stats_check(): Check if module should enable stats Available stats modules: sfc, fast, heap, refill, counters, ring, invariant, pagefault, front, pool, slim, guard, nearempty Updated files: - core/hakmem_tiny_sfc.c: Use hak_stats_check() for SFC stats - core/hakmem_shared_pool.c: Use hak_stats_check() for pool stats Performance: No regression (72.9M ops/s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "hakmem_tiny_superslab.h"
|
||||
#include "hakmem_tiny_superslab_constants.h"
|
||||
#include "hakmem_debug_master.h" // Phase 4b: Master debug control
|
||||
#include "hakmem_stats_master.h" // Phase 4d: Master stats control
|
||||
#include "box/ss_slab_meta_box.h" // Phase 3d-A: SlabMeta Box boundary
|
||||
#include "box/ss_hot_cold_box.h" // Phase 12-1.1: EMPTY slab marking
|
||||
#include "box/pagefault_telemetry_box.h" // Box PageFaultTelemetry (PF_BUCKET_SS_META)
|
||||
@ -80,9 +81,9 @@ static int g_sp_stage_stats_enabled = 0;
|
||||
static int g_sp_stage_stats_log_enabled = -1; // -1=uninitialized, 0=off, 1=on
|
||||
|
||||
static inline void sp_stage_stats_init(void) {
|
||||
// Phase 4d: Now uses hak_stats_check() for unified stats control
|
||||
if (__builtin_expect(g_sp_stage_stats_log_enabled == -1, 0)) {
|
||||
const char* env = getenv("HAKMEM_SHARED_POOL_STAGE_STATS");
|
||||
g_sp_stage_stats_log_enabled = (env && *env && *env != '0') ? 1 : 0;
|
||||
g_sp_stage_stats_log_enabled = hak_stats_check("HAKMEM_SHARED_POOL_STAGE_STATS", "pool");
|
||||
if (g_sp_stage_stats_log_enabled == 1) {
|
||||
// ログが有効なら計測も必ず有効化する。
|
||||
g_sp_stage_stats_enabled = 1;
|
||||
|
||||
Reference in New Issue
Block a user