Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace: when profiling, dump a sampling trace #671

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Fang-
Copy link
Member

@Fang- Fang- commented Jul 9, 2024

Whenever we run under the profiling flag (-P --profile), we now collect sampling traces into .urb/put/trace/dump.txt.

We take care to format the output in a way that's compatible with flamegraph tooling. Specifically, we avoid writing into the first couple lines of the file, and suffix every trace with a counter (always 1), to mimic dtrace output.

(See also brendangregg/FlameGraph.)

We have not yet cleaned up old code in u3t_samp.


After running some ship with --profile, we can use the flamegraph scripts to turn the dump into an svg:

./stackcollapse.pl ~/piers/some-ship/.urb/put/trace/dump.txt | ./flamegraph.pl > dump.svg

If the ship ran -build-file %/sys/hoon/hoon under the profiler, the resulting svg might look something like this:

image

Whenever we run under the profiling flag, we now collect sampling traces
into .urb/put/trace/dump.txt.

We take care to format the output in a way that's compatible with
flamegraph tooling. Specifically, we avoid writing into the first couple
lines of the file, and suffix every trace with a counter (always 1).

(See also brendangregg/FlameGraph.)

We have not yet cleaned up old code in u3t_samp.

Co-authored-by: joemfb <[email protected]>
@tacryt-socryp
Copy link
Contributor

This is sick, love it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants