26 lines
569 B
C
26 lines
569 B
C
|
|
#ifndef HAKMEM_LEARN_LOG_H
|
||
|
|
#define HAKMEM_LEARN_LOG_H
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
uint64_t ts_ns;
|
||
|
|
uintptr_t site;
|
||
|
|
uint32_t size;
|
||
|
|
uint16_t class_idx;
|
||
|
|
uint32_t tid_low;
|
||
|
|
} hkm_log_entry_t;
|
||
|
|
|
||
|
|
typedef struct hkm_log_ring {
|
||
|
|
hkm_log_entry_t entries[1024];
|
||
|
|
volatile uint32_t head; // producer index (per-thread)
|
||
|
|
volatile uint32_t tail; // consumer index (learner)
|
||
|
|
} hkm_log_ring_t;
|
||
|
|
|
||
|
|
void hkm_log_init_tls(void);
|
||
|
|
void hkm_log_maybe(uintptr_t site, uint32_t size, uint16_t class_idx);
|
||
|
|
void hkm_log_flush_file(const char* path);
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|