Expand description
Convert Node V8 .cpuprofile (Inspector Profiler.Profile) JSON into
gzip’d pprof protobuf.
Port of the TypeScript implementation that lived in
@mizchi/pprof-tools/cpuprofile-to-pprof. The cpuprofile schema is a
tree of nodes (nodes[i].children lists child ids) plus a samples
array of leaf node ids and a timeDeltas array (μs) holding the
elapsed time between consecutive samples. We invert children into a
parent map, aggregate samples by leaf node, and emit one pprof Sample
per unique leaf with both samples/count and cpu/nanoseconds
values.
Symbol names go through a caller-supplied demangler. Defaults to
moonbit_demangle::demangle; pass identity (|s| s.into()) when
profiling non-MoonBit code.
Structs§
- Builder
- Builds a pprof Profile from a parsed
CpuProfile. - Call
Frame - V8 call frame (
CallFramein the Inspector domain). - CpuNode
- One node in the cpuprofile call tree.
- CpuProfile
- Parsed shape of
Profiler.Profile(.cpuprofileJSON). - Encoded
Profile - Output of
Builder::encode— gzip’d bytes plus counts. - Stats
- Conversion stats returned alongside the encoded bytes.
Type Aliases§
- Demangle
Fn - Demangler hook —
(name) → pretty name. Defaults tomoonbit_demangle::demangle.