perfetto: fix cgroup stats correctness and wire up trace_processor
Address the review findings on the cgroup sys_stats work:
- Emit all counters. memory.current/high/max, swap and every io.stat
counter were unreachable because their enum ids were absent from
kCgroupKeys and enablement was checked against that map. Enablement now
uses a bitset over all CgroupCounters, and the name->id map covers every
counter.
- Support cgroup v2. File selection no longer keys off "/cpu/" or
"/memory/" path segments, which do not exist in the v2 unified
hierarchy. Each path now probes a fixed file list and skips absent
files, so the same config works on v1 and v2. Removed the hardcoded
v1-only default paths; cgroup_paths must be set explicitly.
- Parse memory.max "max" as uint64 max (unlimited) instead of 0.
- Group counters under one Cgroup{path, repeated Counter} message instead
of repeating the path on every value. Collapsed the duplicate cpu/memory
stat parsers into one and parse io.stat without per-token allocation.
- Ingest SysStats.cgroup in trace_processor as counter tracks dimensioned
by cgroup path, counter name and block device; add a diff test.
- Rename CGROUP_MEMORY_*_THPS to *_THP to match the kernel field names,
wire the doc into docs/toc.md, and expand the unit tests to cover the
limit, swap, io and counter-filter paths.
Perfetto is an open-source suite of SDKs, daemons and tools which use tracing to help developers understand the behaviour of complex systems and root-cause functional and performance issues on client and embedded systems.
It is a production-grade tool that is the default tracing system for the Android operating system and the Chromium browser.
Perfetto is not a single tool, but a collection of components that work together:
Perfetto was designed to be a versatile and powerful tracing system for a wide range of use cases.
ftrace, allowing you to visualize scheduling, syscalls, interrupts, and custom kernel tracepoints on a timeline.chrome://tracing. Use it to debug and root-cause issues in the browser, V8, and Blink.We‘ve designed our documentation to guide you to the right information as quickly as possible, whether you’re a newcomer to performance analysis or an experienced developer.
New to tracing? If you're unfamiliar with concepts like tracing and profiling, start here:
Ready to dive in? Our “Getting Started” guide is the main entry point for all users. It will help you find the right tutorials and documentation for your specific needs:
Want the full overview? For a comprehensive look at what Perfetto is, why it's useful, and who uses it, see our main documentation page:
For users interested in the Debian distribution of Perfetto, the official source of truth and packaging efforts are maintained at Debian Perfetto Salsa Repository
Have questions? Need help?
We follow Google's Open Source Community Guidelines.