说明
来自 jemalloc 堆内存剖析器 的每个存活的采样分配 (sampled allocation) 对应一行;读取该表会刷写一份新的堆内存剖析。只有启用了 profiler 的线程才会贡献数据 (通过jemalloc_enable_profiler SETTING 或 jemalloc_enable_global_profiler config) ;每行大致代表 weight 个类似的分配。
列
trace(Array(UInt64)) — 分配调用栈的地址,叶子 (leaf) 栈帧在前 (与system.trace_log.trace的约定一致) 。可使用addressToSymbol和demangle进行符号化 (需要allow_introspection_functions) 。age_ns(UInt64) — 该次分配已存活的时间 (纳秒) ,相对于 profile 被刷写的时刻计算。size(UInt64) — 请求的分配大小,单位为字节。usize(UInt64) — 可用大小 (字节) ,即该请求被向上取整到的大小类。size_class(UInt16) — 大小类的索引。对于较小的大小类,可与system.jemalloc_bins.index进行 join。arena(UInt32) — 提供本次分配的 arena 的索引。thr_uid(UInt64) — 执行分配的线程在 jemalloc 内部的唯一 id。sample_interval(UInt64) — 两次采样之间平均分配的字节数,取自 profile 的头部信息。所有行的该值相同。
alloc_time—now() - intDiv(age_ns, 1000000000)的别名。weight—1 / (1 - exp((-usize) / sample_interval))的别名。