Am I missing the obvious? (cargo build/run integration)
MagaTailor opened this issue · comments
Do you still have to manually build the binary you wish to profile with e.g. cargo build
?
I mean, if a Cargo.toml exists I'd expect the following to work:
cargo profiler callgrind
or cargo --release profiler callgrind
BTW, profiler prints nothing after interrupting with Ctrl+C
.
I'd expect it to be ordered like this cargo profiler callgrind --release
but have to agree on the general thought.
@regexident Right, I meant profiler --release
, the original syntax isn't even valid in cargo.
Ah my bad, can't believe I missed that. Should get that implemented.
This is in the works, should be up by tomorrow.
Bonus points for also supporting cargo profiler callgrind --release -- --some=thing -v --flag
, which would then pass over --some=thing -v --flag
to the running executable. 💯 cough
This is available in v0.1.3. Closing this issue, as #7 references binary arguments which still remains an open issue.
Thanks @pegasos1, beginning to look really great! Two issues:
- compilation is hidden,
--verbose
can't be passed to cargo in any position - building and running examples, normally via
cargo run --example some_example
, doesn't work yet - we're already running binaries, so maybe, for super tight integration, profiler could check for available examples and build the one passed to it, likecargo profiler callgrind some_example
?
Even though it's a different issue, my 2nd comment is a much more serious problem at the moment. Not all programmes terminate naturally or it can be impractical to wait that long.
@petevine, I'm going to open up some new issues addressing these, they should be fairly straightforward to implement. Thanks so much for pointing these out!
Also, completely overlooked the comment. Do you know if there's currently a way to catch Ctrl +C
via std? I found this crate that could help us do this, as well as this conversation.
Not sure about a cross-platform std solution - from the links you provided it seems it's still WIP. But on *nix you should be fine using @BurntSushi's crate.