Parents: #140, #143 Profiles: #163, #164 Roadmap: #134
Implement the three pinned Bun CPU sampling-profiler boundaries as a real, per-VM profiler. The ABI remains revision-compatible, but the internal design must not copy upstream's process-global running state into a multi-VM engine.
Scope
- Pin Bun
4982b91eBunCPUProfiler.zig/BunCPUProfiler.cpp, exact Chrome CPU-profile fields, Markdown sections, and Home output-layout divergence. - Implement
Bun__setSamplingIntervalwith validated, atomic interval publication. - Implement
Bun__startCPUProfilerwith per-VM lifecycle, restart/idempotence rules, monotonic start time, and no cross-VM contamination. - Sample real executing stacks at safe interpreter/JIT checkpoints without racing frame teardown or invoking JavaScript.
- Implement
Bun__stopCPUProfilerwith Chrome-compatible nodes, samples, time deltas, source positions/position ticks, and exact start/end timestamps. - Emit the pinned Markdown aggregate, caller/callee, and file breakdown from the same sample set.
- Preserve distinct Home pointer and Bun by-value string output ownership, including optional JSON/text outputs and release behavior.
- Cover nested/recursive/anonymous/async frames, source URLs and offsets, idle/no-sample profiles, interval changes, repeated start/stop, sibling realms, invalid VMs, and OOM/failure atomicity.
- Add bounded Debug, ReleaseSafe, and TSan fixtures; refresh both inventories, README counts, docs, and roadmap evidence.
- Close only after the exact fixing
mainCI job is green.
No timer thread may read mutable interpreter frames without the VM's safe publication protocol. A cooperative checkpoint sampler is preferable to an observably racy imitation of JSC's asynchronous sampler.