32 lines
837 B
C
32 lines
837 B
C
|
|
// tiny_destructors.h — Tiny の終了処理・統計ダンプを箱化
|
||
|
|
#ifndef TINY_DESTRUCTORS_H
|
||
|
|
#define TINY_DESTRUCTORS_H
|
||
|
|
|
||
|
|
#include <stdatomic.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <stdlib.h>
|
||
|
|
|
||
|
|
#include "hakmem_tiny.h"
|
||
|
|
|
||
|
|
typedef struct {
|
||
|
|
_Atomic uint64_t prepare_calls;
|
||
|
|
_Atomic uint64_t prepare_with_current_null;
|
||
|
|
_Atomic uint64_t prepare_from_partial;
|
||
|
|
_Atomic uint64_t free_made_current;
|
||
|
|
_Atomic uint64_t page_retired;
|
||
|
|
} TinyHotHeapV2PageStats;
|
||
|
|
|
||
|
|
static inline int tiny_hotheap_v2_stats_enabled(void) {
|
||
|
|
static int g = -1;
|
||
|
|
if (__builtin_expect(g == -1, 0)) {
|
||
|
|
const char* e = getenv("HAKMEM_TINY_HOTHEAP_V2_STATS");
|
||
|
|
g = (e && *e && *e != '0') ? 1 : 0;
|
||
|
|
}
|
||
|
|
return g;
|
||
|
|
}
|
||
|
|
|
||
|
|
void tiny_destructors_configure_from_env(void);
|
||
|
|
void tiny_destructors_register_exit(void);
|
||
|
|
|
||
|
|
#endif // TINY_DESTRUCTORS_H
|