cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Piping into and out of the profiled binary

walles opened this issue · comments

I want to profile this command line:

riff < /tmp/glp.txt > /dev/null

How can I do that using cargo instruments?

Riff is a filter that reads data from stdin and prints it to stdout.

If I just start riff using cargo instruments, ptop says that riff's stdin and stdout are both connected to instruments, which is not what I want.

How do I tell cargo instruments how to set up stdin and stdout for the profiled binary?

I believe that instruments itself consumes stdin and stderr; you can verify this by running instruments directly and seeing if there's any way to get your binary's output? Assuming this is the case I don't know how to work around this. :(

I didn't get it working.

This I think should have worked, but it didn't:

xcrun xctrace record --template "Time Profiler" --target-stdin - --target-stdout - --launch -- target/debug/riff

What I did as a workaround BTW was:

  • start a full-system profile from the Instruments UI
  • run riff
  • after riff finished, press the stop button in the Instruments UI

Then scroll down to riff in the Instruments UI and see what happened.

you should consider opening a radar with apple (or whatever the new version of radar is) in which case send me the number and I'll file a dupe.