svenstaro / cargo-profiler

Cargo subcommand to profile binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

yep, this was referenced in #7. The open PR #12 addresses most of the issues. all that needs to be addressed is binary arguments as well as custom output directories, and we're golden. seems like people are looking for similar improvements, which is good.

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, like cargo 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.

You can check out/comment on #14 #15 #16

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.

Also e.g. parity uses the ctrlc crate.