Skip to content

feature: allow choosing custom build profiles #257

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

Closed
jtmoon79 opened this issue Mar 18, 2023 · 4 comments
Closed

feature: allow choosing custom build profiles #257

jtmoon79 opened this issue Mar 18, 2023 · 4 comments

Comments

@jtmoon79
Copy link

tl;dr allow passing --profile to cargo flamegraph

Problem

In Cargo.toml, I optimized the release profile for the binary.

[profile.release]
codegen-units = 1
panic = "abort"
strip = true

Now cargo flamegraph fails with

$ cargo flamegraph --bin my_program
...
Error: unable to generate a flamegraph from the collapsed stack data

Caused by:
    0: I/O error: No stack counts found
    1: No stack counts found

Solution

Allow passing --profile=profile_name to cargo flamegraph, similar to cargo build --profile=.... Then flamegraph could then pass the profile_name to the underlying cargo build --profile= call. This would allow creating a custom profile for flamegraph in Cargo.toml.

For example, I would then be able to add to Cargo.toml:

[profile.flamegraph]
inherits = "release"
codegen-units = 16
panic = "unwind"
strip = false

and then I could select that build profile with

$ cargo flamegraph --bin my_program --profile flamegraph
@jtmoon79 jtmoon79 changed the title feature: allow choosing custom profiles feature: allow choosing custom build profiles Mar 18, 2023
@djc
Copy link
Contributor

djc commented Mar 18, 2023

Makes sense, want to submit a PR?

@jtmoon79
Copy link
Author

Makes sense, want to submit a PR?

I'll put it on my TODO list.

@jtmoon79
Copy link
Author

jtmoon79 commented May 3, 2023

@djc I think this feature was already implemented by @madadam in c532c04 (Issue #167 )

/// Build with the specified profile
#[clap(long)]
profile: Option<String>,

Could a new version of flamegraph be released?

@jtmoon79 jtmoon79 closed this as completed May 3, 2023
@djc
Copy link
Contributor

djc commented May 19, 2023

Released https://github.com/flamegraph-rs/flamegraph/releases/tag/v0.6.3 last week.

jtmoon79 added a commit to jtmoon79/super-speedy-syslog-searcher that referenced this issue May 21, 2023
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

No branches or pull requests

2 participants