76 if (!arena || !stream)
79 fprintf(stream,
"──────────────────────────────\n");
80 fprintf(stream,
" Arena Diagnostics (%s)\n", arena->debug.label ? arena->debug.label :
"unnamed");
81 fprintf(stream,
"──────────────────────────────\n");
84 fprintf(stream,
"- Buffer Address: %p\n", (
void*) arena->buffer);
85 fprintf(stream,
"- Buffer Size: %zu bytes\n", arena->size);
86 fprintf(stream,
"- Current Offset: %zu bytes\n", arena->offset);
87 fprintf(stream,
"- Remaining Space: %zu bytes\n", arena->size - arena->offset);
88 fprintf(stream,
"- Peak Usage: %zu bytes\n", arena->stats.peak_usage);
89 fprintf(stream,
"- Can Grow: %s\n",
90 atomic_load_explicit(&arena->can_grow, memory_order_acquire) ?
"yes" :
"no");
93 fprintf(stream,
"- Allocations: %zu\n", arena->stats.allocations);
94 fprintf(stream,
"- Reallocations: %zu\n", arena->stats.reallocations);
95 fprintf(stream,
"- Failed Allocations: %zu\n", arena->stats.failed_allocations);
96 fprintf(stream,
"- Live Allocations: %zu\n", arena->stats.live_allocations);
97 fprintf(stream,
"- Bytes Allocated: %zu bytes\n", arena->stats.bytes_allocated);
98 fprintf(stream,
"- Wasted Alignment Bytes: %zu bytes\n", arena->stats.wasted_alignment_bytes);
99 fprintf(stream,
"- Shrinks: %zu\n", arena->stats.shrinks);
102 fprintf(stream,
"- Last Alloc Size: %zu bytes\n", arena->stats.last_alloc_size);
103 fprintf(stream,
"- Last Alloc Offset: %zu\n", arena->stats.last_alloc_offset);
104 fprintf(stream,
"- Last Alloc ID: %zu\n", arena->stats.last_alloc_id);
107 fprintf(stream,
"- Debug ID: %s\n", arena->debug.id);
108 fprintf(stream,
"- Subarena Counter: %d\n", arena->debug.subarena_counter);
109 fprintf(stream,
"- Hook Installed: %s\n", arena->hooks.hook_cb ?
"yes" :
"no");
110#ifdef ARENA_ENABLE_THREAD_SAFE
111 fprintf(stream,
"- Thread Safety: %s\n", arena->use_lock ?
"enabled" :
"disabled");
115 if (arena->stats.growth_history_count > 0)
117 fprintf(stream,
"- Growth History: ");
118 for (
size_t i = 0; i < arena->stats.growth_history_count; ++i)
119 fprintf(stream,
"%zu ", arena->stats.growth_history[i]);
120 fprintf(stream,
"\n");
124 fprintf(stream,
"- Growth History: (none)\n");