0

Context

When I was trying to run a Criterion.rs benchmark as a standalone binary, I carried out the following steps:

  1. Run cargo bench. This shows me the path to the binary (target/release/...):
    > cargo bench --features dhat-heap --bench smallvec-vs-vec "copy_slice"
       Finished bench [optimized + debuginfo] target(s) in 0.05s
    Running benches/smallvec-vs-vec.rs (target/release/deps/smallvec_vs_vec-e6e8e56958d6365b)
    
  2. After invoking it, I realized it requires the --bench flag to actually run the benchmark. ./<binary-path> --bench. Otherwise it wouldn't run.

Question

If faced with a similar problem (trying to figure out the binary invocation) I would like to use the right tool for it.

I tried using dtruss, so I can see the binary invocation via syscall execve. However, after running dtruss, nowhere in my output there is the binary invocation: target/release/deps/....

What I'm wondering is whether I'm using the right tool (dtruss?) or if it is, what flags I should be using instead.

Here's the way I setup dtruss:

<cargo-cmd> & # get the pid from here.
sudo dtruss -p <pid> 2>&1 | grep target/release
Noel Kwan
  • 123
  • 1
  • 5
  • Hmmm, I actually feel this shouldn't be necessary since program arguments are shown in other contexts. i.e. `cargo run -- args` will display "Running 'target/debug/mycrate args'". But you're right, it doesn't indicate that for `cargo bench`. I feel the same courtesy should be given here as well so I'm tempted to make a feature request for it. – kmdreko Apr 11 '23 at 16:32

0 Answers0