Improve flamegraph profiling: deeper stacks, off-CPU, better CSV#173
Merged
Improve flamegraph profiling: deeper stacks, off-CPU, better CSV#173
Conversation
added 3 commits
April 5, 2026 11:23
- Use dwarf,16384 stack dump size instead of default 8192 to capture complete async call stacks in tokio - Add FLAMEGRAPH_OFFCPU=1 mode using offcputime-bpfcc to show where pg_doorman waits (locks, pool, I/O) as a blue flamegraph - Generate profile.csv with both self and inclusive cost per function, plus summary.csv with CPU breakdown by category
- Use /usr/share/bcc/tools/offcputime path (Fedora puts bcc tools outside PATH), with fallback to offcputime-bpfcc and PATH lookup - Clean offcputime output before passing to inferno: strip user/kernel separator '-' and [unknown] frames - Pass file argument to inferno-flamegraph instead of stdin pipe (inferno fails with "No such file" when reading from pipe)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dwarf,16384stack dump size for complete tokio async call stacks (default 8192 truncates deep stacks)FLAMEGRAPH_OFFCPU=1mode — generates blue flamegraph showing where pg_doorman waits (locks, pool contention, I/O) viaoffcputime-bpfccprofile.csvwith both self and inclusive cost per function, plussummary.csvwith CPU breakdown by category (pg_doorman, tokio, allocator, kernel_tcp, kernel_nftables, etc.)Usage
New artifacts
Test plan
make flamegraphproduces all artifacts including new CSVsprofile.csvhas correct inclusive cost (entry_SYSCALL at 72%, pg_doorman::handle at 63%)summary.csvshows meaningful category breakdownFLAMEGRAPH_OFFCPU=1 make flamegraphwith bcc-tools installed