Skip to content

Commit

Permalink
Add skip_after option to flamegraph (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
romange authored Nov 16, 2021
1 parent 243380a commit eccf867
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ path = "src/bin/flamegraph.rs"
[dependencies]
anyhow = "1.0.43"
cargo_metadata = "0.14.0"
inferno = "0.10.0"
inferno = "0.10.8"
opener = "0.5.0"
structopt = "0.3.14"

Expand Down
14 changes: 13 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,15 @@ pub fn generate_flamegraph_for_workload(

let collapsed_writer = BufWriter::new(&mut collapsed);

let collapse_options = CollapseOptions::default();
#[allow(unused_mut)]
let mut collapse_options = CollapseOptions::default();

#[cfg(target_os = "linux")]
{
if let Some(skip_after) = &opts.flamegraph_options.skip_after {
collapse_options.skip_after = Some(skip_after.into())
}
}

Folder::from(collapse_options)
.collapse(perf_reader, collapsed_writer)
Expand Down Expand Up @@ -386,6 +394,10 @@ pub struct FlamegraphOptions {
]
)]
pub palette: Option<Palette>,

#[cfg(target_os = "linux")]
#[structopt(long = "skip-after")]
pub skip_after: Option<String>,
}

impl FlamegraphOptions {
Expand Down

0 comments on commit eccf867

Please sign in to comment.