How to set up a profiler config for XCode

Trying to figure out where my plugin is burning CPU with XCode and Instruments I ran into an issue with the XCode configurations created in Projucer. For profiling I would need a config that is identical to “Release”, but has debug symbols enabled so I can see what’s happening in instruments. So I checked “Debugging enabled” on the Projucer config page. Only much later I realized, that this of course enabled all the debug code and that I was seeing bottlenecks where there are jassert() calls in the code.

Is there a way to make a config that creates debug symbols but does not define DEBUG _DEBUG and JUCE_DEBUG (1) ? Right now I have to manually edit the XCode config after each Projucer change which is of course error-prone should I profile again (and forget about it).

Yes there is one!

Do not check “Debugging enabled” and then add the following to the “Custom Xcode flags” field:


You can also add more Xcode settings (separated by commas) to control what kind of debugging information Xcode will produce (GCC_DEBUGGING_SYMBOLS, DEBUG_INFORMATION_FORMAT…).

Have a look at Xcode Build Settings Reference for the comprehensive list of Xcode settings.

That forum thread could also be interesting:


Thanks a lot for this helpful information. I successfully set up my profiler configs to use with Instruments. However I’m not 100% where I want to be. I remember back in the day there was Shark and it made it easy to identify which lines of code use the most performance by showing performance numbers right next to the source code lines. I see the same kind of thing is included with Instruments, but I have two problems. Sometimes Instruments cannot find my source code files and just shows assembly and when it finds the correct file, the lines seem to be off by a few lines sometimes. Weirdly enough I sometimes get “hotspots” just a few lines below the function/method that has been measured to use a lot of CPU. So it all seems to be quite unreliable. I trust the call tree numbers are ok, but somehow the mapping to the sources doesn’t work as well as I’d like. This all happens if I attach Instruments to AU Lab which loads my plugin build with my “Profile” config.

Has anyone gotten this to work reliably with Instruments?