cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stdout

vim-zz opened this issue · comments

When running with cargo instruments I can't see any output on the screen, is there a way to enable stdout?

As far as I can tell, the instruments cli that we call swallows stdout from the child process, and there's no documented way to change this behaviour. The easiest workaround I can think of is to redirect stdout to a file for profiling; you could use a custom replacement of println! to make this easier. 😢

understood

It's possible to capture the stdout from any PID with:

capture() {
  sudo dtrace -p "$1" -qn '
        syscall::write*:entry
        /pid == $target && arg0 == 1/ {
            printf("%s", copyinstr(arg1, arg2));
        }
    '
}

# capture 1234

If I find the PID for target/debug can confirm it works