pub fn capture() -> CtprofSnapshotExpand description
Capture a complete host-wide snapshot against the default
procfs and cgroup roots (/proc and /sys/fs/cgroup).
Probes every jemalloc-linked tgid the walk reaches and
populates per-thread allocated_bytes / deallocated_bytes
from the jemalloc TSD counters; tgids the probe cannot attach
against (ptrace denied, not jemalloc-linked, stripped binary)
land their threads at the absent-counter default of 0 per the
best-effort capture contract.
§Cost
O(threads-on-host) for the procfs walk; additionally one ELF
open + DWARF parse for every tgid attach_jemalloc resolves
successfully, plus a ptrace seize/interrupt/waitpid/detach
round-trip per thread of those tgids. On a host with many
jemalloc-linked daemons (database / browser / runtime
processes) the probe path dominates the wall-clock cost.
Callers that need only one tgid’s data should use
capture_pid to scope the walk.