Skip to content

Commit 3ca8825

Browse files
committed
Add support for cargo --profile
Closes #167
1 parent b65fd83 commit 3ca8825

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/bin/cargo-flamegraph.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ struct Opt {
1212
#[clap(long)]
1313
dev: bool,
1414

15+
/// Build with the specified profile
16+
#[clap(long)]
17+
profile: Option<String>,
18+
1519
/// package with the binary to run
1620
#[clap(short, long)]
1721
package: Option<String>,
@@ -84,9 +88,13 @@ fn build(opt: &Opt, kind: impl IntoIterator<Item = String>) -> anyhow::Result<Ve
8488
cmd.arg("build");
8589
}
8690

87-
// do not use `--release` when we are building for `bench`
88-
if !opt.dev && opt.bench.is_none() {
89-
cmd.arg("--release");
91+
if let Some(profile) = &opt.profile {
92+
cmd.arg("--profile").arg(profile);
93+
} else {
94+
// do not use `--release` when we are building for `bench`
95+
if !opt.dev && opt.bench.is_none() {
96+
cmd.arg("--release");
97+
}
9098
}
9199

92100
if let Some(ref package) = opt.package {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ pub struct FlamegraphOptions {
501501
pub notes: Option<String>,
502502

503503
/// Omit functions smaller than <FLOAT> pixels
504-
#[clap(long, default_value = "0.01f32", value_name = "FLOAT")]
504+
#[clap(long, default_value = "0.01", value_name = "FLOAT")]
505505
pub min_width: f64,
506506

507507
/// Image width in pixels

0 commit comments

Comments
 (0)