Files
hakmem/core/hakmem_sizeclass_dist.h
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

53 lines
1.8 KiB
C

// hakmem_sizeclass_dist.h - Size Class Distribution Signature
// Purpose: Detect workload changes via L1 distance
//
// License: MIT
// Date: 2025-10-21
#ifndef HAKMEM_SIZECLASS_DIST_H
#define HAKMEM_SIZECLASS_DIST_H
#include <stdint.h>
#include <stddef.h>
// ============================================================================
// Size Class Distribution (4 classes: 1MB, 2MB, 4MB, 8MB)
// ============================================================================
#define SIZECLASS_NUM_CLASSES 4
typedef struct {
uint32_t freq[SIZECLASS_NUM_CLASSES]; // Frequency of each class
uint64_t total; // Total allocations recorded
} hak_sizeclass_dist_t;
// ============================================================================
// Public API
// ============================================================================
// Initialize distribution
void hak_sizeclass_dist_init(hak_sizeclass_dist_t* dist);
// Record an allocation size (will classify into size class)
void hak_sizeclass_dist_record(hak_sizeclass_dist_t* dist, size_t size);
// Calculate L1 distance between two distributions
// Returns: 0.0 (identical) to 2.0 (completely different)
double hak_sizeclass_dist_l1(const hak_sizeclass_dist_t* a,
const hak_sizeclass_dist_t* b);
// Copy distribution
void hak_sizeclass_dist_copy(hak_sizeclass_dist_t* dst,
const hak_sizeclass_dist_t* src);
// Reset distribution (start new window)
void hak_sizeclass_dist_reset(hak_sizeclass_dist_t* dist);
// Get total allocations
uint64_t hak_sizeclass_dist_total(const hak_sizeclass_dist_t* dist);
// Print distribution (for debugging)
void hak_sizeclass_dist_print(const hak_sizeclass_dist_t* dist, const char* label);
#endif // HAKMEM_SIZECLASS_DIST_H