Add TinyHeap class mask and extend routing
This commit is contained in:
@ -26,6 +26,8 @@
|
||||
#include "tiny_tls_guard.h"
|
||||
#include "tiny_ready.h"
|
||||
#include "box/c7_meta_used_counter_box.h"
|
||||
#include "box/tiny_c7_hotbox.h"
|
||||
#include "box/tiny_heap_box.h"
|
||||
#include "box/super_reg_box.h"
|
||||
#include "hakmem_tiny_tls_list.h"
|
||||
#include "hakmem_tiny_remote_target.h" // Phase 2C-1: Remote target queue
|
||||
@ -45,6 +47,50 @@ extern uint64_t g_bytes_allocated; // from hakmem_tiny_superslab.c
|
||||
// Debug: TLS SLL last push tracking (for core/box/tls_sll_box.h)
|
||||
// ============================================================================
|
||||
__thread hak_base_ptr_t s_tls_sll_last_push[TINY_NUM_CLASSES] = {0};
|
||||
__thread tiny_heap_ctx_t g_tiny_heap_ctx;
|
||||
__thread int g_tiny_heap_ctx_init = 0;
|
||||
TinyC7HeapStats g_c7_heap_stats = {0};
|
||||
|
||||
static int tiny_c7_heap_stats_dump_enabled(void) {
|
||||
static int g = -1;
|
||||
if (__builtin_expect(g == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_TINY_C7_HEAP_STATS_DUMP");
|
||||
g = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
__attribute__((destructor))
|
||||
static void tiny_c7_heap_stats_dump(void) {
|
||||
if (!tiny_c7_heap_stats_enabled() || !tiny_c7_heap_stats_dump_enabled()) {
|
||||
return;
|
||||
}
|
||||
TinyC7HeapStats snap = {
|
||||
.alloc_fast_current = atomic_load_explicit(&g_c7_heap_stats.alloc_fast_current, memory_order_relaxed),
|
||||
.alloc_slow_prepare = atomic_load_explicit(&g_c7_heap_stats.alloc_slow_prepare, memory_order_relaxed),
|
||||
.free_fast_local = atomic_load_explicit(&g_c7_heap_stats.free_fast_local, memory_order_relaxed),
|
||||
.free_slow_fallback = atomic_load_explicit(&g_c7_heap_stats.free_slow_fallback, memory_order_relaxed),
|
||||
.alloc_prepare_fail = atomic_load_explicit(&g_c7_heap_stats.alloc_prepare_fail, memory_order_relaxed),
|
||||
.alloc_fail = atomic_load_explicit(&g_c7_heap_stats.alloc_fail, memory_order_relaxed),
|
||||
};
|
||||
fprintf(stderr,
|
||||
"[C7_HEAP_STATS] alloc_fast_current=%llu alloc_slow_prepare=%llu free_fast_local=%llu free_slow_fallback=%llu alloc_prepare_fail=%llu alloc_fail=%llu\n",
|
||||
(unsigned long long)snap.alloc_fast_current,
|
||||
(unsigned long long)snap.alloc_slow_prepare,
|
||||
(unsigned long long)snap.free_fast_local,
|
||||
(unsigned long long)snap.free_slow_fallback,
|
||||
(unsigned long long)snap.alloc_prepare_fail,
|
||||
(unsigned long long)snap.alloc_fail);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
__attribute__((destructor))
|
||||
static void tiny_c7_delta_debug_destructor(void) {
|
||||
if (!tiny_c7_meta_light_enabled() || !tiny_c7_delta_debug_enabled()) {
|
||||
return;
|
||||
}
|
||||
tiny_c7_heap_debug_dump_deltas();
|
||||
}
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
// Helper to dump last push from core/hakmem.c (SEGV handler)
|
||||
|
||||
Reference in New Issue
Block a user