How use Instruments and display the console in Command Lines applications How use Instruments and display the console in Command Lines applications xcode xcode

How use Instruments and display the console in Command Lines applications


It's a little late to contribute to this old thread, however I have found the best way of profiling a command line utility is to use iprofiler (manpage). This allows data to be collected from the command line simply by adding this to the start of the command line:

iprofiler -leaks -d $HOME/tmp

(I have a private temporary directory at $HOME/tmp, so you might need to use /tmp or leave the -d command line option off altogether).

My test scripts automatically add that to the command line if $FINDLEAKS is defined (and will prepend valgrind if running under Linux).

This then generates a .dtps file (actually a directory) which can be loaded and anaylysed using Instruments.

If you are compiling using clang then simply add both -O3 and -g (clang doesn't support the -pg command line option).


You can change the output in the Options dropdown when choosing your target. The output will appear in the system Console (Applications/Utilities/Console).

IO options