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

Passing ARGS which begin with --? #89

Open
morrisonlevi opened this issue Aug 7, 2023 · 1 comment
Open

Passing ARGS which begin with --? #89

morrisonlevi opened this issue Aug 7, 2023 · 1 comment

Comments

@morrisonlevi
Copy link

morrisonlevi commented Aug 7, 2023

I'm trying to run a command like this:

cargo instruments --all-features --bench $bench -t time --profile-time 5

Where --profile-time 5 is supposed to be an argument to the benchmark for criterion: https://bheisler.github.io/criterion.rs/book/user_guide/profiling.html.

However, I get an error:

error: Found argument '--profile-time' which wasn't expected, or isn't valid in this context

I tried the classic -- e.g.

cargo instruments --all-features --bench $bench -t time -- --profile-time 5

I didn't get an error, but the benchmark definitely didn't run for 5 seconds. I'm not sure exactly what happened.

@cmyr
Copy link
Owner

cmyr commented Aug 7, 2023

hmm, interesting. In this example, who is supposed to be handling that flag? I don't imagine it's handled by cargo/rustc (since they don't know about criterion) and so I imagine it's being handled by whatever is executed in criterion to handle running a benchmark, but I'm not really sure how that works, and I'm not sure how best to pass arguments to that process. It's even possible that this flag is handled at compile time, and actually modifies the generated binary?

I'm not going to have time to investigate this much myself, but if you're curious to dig into it the first question to figure out would be, basically: who is handling this flag generally? Is it rustc, the criterion bench runner, or the final binary? If it's the bench runner I'm not sure there's an answer, since afaik criterion doesn't get invoked when you run a bench target through cargo instruments; we just ask rustc to build the bench target, it creates an executable, and we run that.

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