-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add support for combined stack + ustack DTrace collapse #328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for contributing a fix!
src/collapse/dtrace.rs
Outdated
@@ -226,7 +231,7 @@ impl CollapsePrivate for Folder { | |||
} | |||
} | |||
} | |||
true | |||
std::mem::take(&mut self.has_seen_digit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem quite right. In particular, it means has_seen_digit
won't be reset to false
if we hit a return false
earlier. Not sure if that's intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I realized that this is more complicated than necessary. f1e6fbf simplifies it and adds a unit test.
@@ -0,0 +1,4 @@ | |||
libc.so.1`_lwp_start;libc.so.1`_thrp_setup;cru-ds-fdsync-v1`std::sys::unix::thread::Thread::new::thread_start;cru-ds-fdsync-v1`core::ops::function::FnOnce::call_once{{vtable.shim}};cru-ds-fdsync-v1`std::sys_common::backtrace::__rust_begin_short_backtrace;cru-ds-fdsync-v1`rayon_core::registry::ThreadBuilder::run;cru-ds-fdsync-v1`rayon_core::registry::WorkerThread::wait_until_cold;cru-ds-fdsync-v1`<rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute;cru-ds-fdsync-v1`std::panicking::try;cru-ds-fdsync-v1`crucible_downstairs::extent::Extent::flush;cru-ds-fdsync-v1`<crucible_downstairs::extent_inner_raw::RawInner as crucible_downstairs::extent::ExtentInner>::flush;cru-ds-fdsync-v1`std::fs::File::sync_all;libc.so.1`__fdsync;unix`sys_syscall;genunix`fdsync;genunix`fop_fsync;zfs`zfs_fsync;zfs`zil_commit;zfs`zil_commit_impl;zfs`zil_commit_itx_assign;zfs`zil_itx_assign;zfs`dmu_objset_ds 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should do something to annotate that these come from calls in the kernel so that they can be given a different color in the flamegraph output given we have that information from DTrace? Feels like a shame to throw it away. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's certainly a bunch of data in here that we're not using, but I'd worry about overspecializing for a particular system.
My ideal system would be something like a config file that specifies regex → palette, or even a small DSL for generating a color.
[
{
"regex": "zfs`",
"palette": "warm"
},
{
"regex": "libc`",
"palette": "cool"
},
{
"regex": ".*::.*",
"palette": "green"
}
...etc
]
The language-specific color schemes could be represented with this format, but users could also bring their own config file for flexibility (without having to edit inferno
itself)
Anyways, this is probably orthogonal to the PR 😄
@jonhoo I think this is good to go; the remaining CI failure is a Codeconv rate limit 😅 |
f1e6fbf
to
eb7354e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Releasing in #330 |
I've been using
flamegraph
to get user + kernel flamegraphs, with a custom DTrace profiling commandHowever, this puts the user + kernel stacks side by side, when in fact some of the user stacks are calling into the kernel:
It's possible to get a combined stack with
Sampling both stacks simultaneously means there's an extra newline between the kernel and user stacks, e.g.
This PR updates the DTrace collapser to support stacks with this bonus newline. It's backwards compatible for
ustack
-only traces, and includes a new unit test for the new behavior.