Files
hakmem/archive/tools/analyze_overhead.c
Moe Charm (CI) 52386401b3 Debug Counters Implementation - Clean History
Major Features:
- Debug counter infrastructure for Refill Stage tracking
- Free Pipeline counters (ss_local, ss_remote, tls_sll)
- Diagnostic counters for early return analysis
- Unified larson.sh benchmark runner with profiles
- Phase 6-3 regression analysis documentation

Bug Fixes:
- Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB)
- Fix profile variable naming consistency
- Add .gitignore patterns for large files

Performance:
- Phase 6-3: 4.79 M ops/s (has OOM risk)
- With SuperSlab: 3.13 M ops/s (+19% improvement)

This is a clean repository without large log files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 12:31:14 +09:00

37 lines
1.4 KiB
C

#include <stdio.h>
#include <stdlib.h>
int main() {
printf("=== HAKMEM Tiny Pool Memory Overhead Analysis ===\n\n");
// 1M allocations of 16B
const int num_allocs = 1000000;
const int alloc_size = 16;
const int slab_size = 65536; // 64KB
const int blocks_per_slab = slab_size / alloc_size; // 4096
printf("Data:\n");
printf(" Total allocations: %d\n", num_allocs);
printf(" Allocation size: %d bytes\n", alloc_size);
printf(" Actual data: %d MB\n\n", num_allocs * alloc_size / 1024 / 1024);
printf("Slab overhead:\n");
printf(" Slab size: %d KB\n", slab_size / 1024);
printf(" Blocks per slab: %d\n", blocks_per_slab);
printf(" Slabs needed: %d\n", (num_allocs + blocks_per_slab - 1) / blocks_per_slab);
printf(" Total slab memory: %d MB\n",
((num_allocs + blocks_per_slab - 1) / blocks_per_slab) * slab_size / 1024 / 1024);
printf("\nTLS Magazine overhead:\n");
printf(" Magazine capacity: 2048 items\n");
printf(" Size classes: 8\n");
printf(" Pointer size: 8 bytes\n");
printf(" Per-thread overhead: %d KB\n", 2048 * 8 * 8 / 1024);
printf("\nBitmap overhead per slab:\n");
printf(" Bitmap size: %d bytes (1 bit per block)\n", blocks_per_slab / 8);
printf(" Summary bitmap: ~%d bytes\n", (blocks_per_slab / 8) / 64);
return 0;
}