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

Piping into and out of the profiled binary #25

Open
walles opened this issue Nov 26, 2020 · 4 comments
Open

Piping into and out of the profiled binary #25

walles opened this issue Nov 26, 2020 · 4 comments

Comments

@walles
Copy link

walles commented Nov 26, 2020

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?

@cmyr
Copy link
Owner

cmyr commented Nov 27, 2020

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. :(

@walles
Copy link
Author

walles commented Nov 27, 2020

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

@walles
Copy link
Author

walles commented Nov 27, 2020

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.

@cmyr
Copy link
Owner

cmyr commented Nov 27, 2020

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.

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