How to use ''Instruments'' on OS/X to profile
The instruments profiles can be run from the command line, but it doesn't seem to pick up the symbols for the executables when run that way with Xcode 9. Here's how to fix that.
1 Building symbols
Even though executables are built using -g3 -O0, OS/X clang/gcc dies not include those symbols in binary images built by the linker. To make that info available to instruments, use the program dsymutil on the executable, .dylib and/or .so. This may be an iterative process; see the next section.
2 Running instruments
Once the <name>.dSYM directories are built, run the instruments GUI and:
- Click the menu to Choose Target...
- Navigate to the program to run - yes, it's tedious.
- Choose the program (note that the dSYM dir is there too)
- provide the arguments to the program
- and, below that, the full path to the working directory.