Xcode 7: Compare Instruments Call Trees

September 28th, 2015

Filed under: Instruments, Xcode | 2 comments

A new feature of Instruments in Xcode 7 is the ability to compare two call trees in the Time Profiler instrument. This article provides a brief introduction on using this feature. Comparing two call trees is also available in the Counters template (it was disabled for me in every other template), but I’m going to focus on the Time Profiler instrument since it’s the more commonly used instrument.

To take advantage of comparing two call trees, you must perform at least two profiling runs of your application so you have two call trees to compare. After performing two runs in Instruments, choose Instrument > Compare Call Trees. The detail view should look similar to the following screenshot:

InstrumentsCompareCallTrees

Instead of showing the total running time, Instruments shows the difference in running time between the two runs along with a percentage of the difference. Functions with a higher running time have the percentage colored red, and functions with a lower running time have the percentage colored green. The difference in running time is from the perspective of the most recent run.

Above the call tree statistics are two menus. The left menu is initially set to Diff, which means Instruments shows the differences between the two call trees. You can also choose Merge, which merges the two call trees in one listing. The right menu lets you choose an Instruments run to compare. You’ll need at least three runs to use the right menu.

UPDATE

Apple removed the Compare Call Trees feature in Xcode 9. The Compare Call Trees menu item is disabled in Xcode 9 and is removed in Xcode 10.

Tags:


2 thoughts on “Xcode 7: Compare Instruments Call Trees

  1. Toaster says:

    Even after having multiple runs, “Compare Call Tree” is disabled for me on Instruments 9.0

    • Mark Szymczyk says:

      I noticed the Compare Call Trees menu item was disabled for me in the Time Profiler instrument in Xcode 9.1 too. I don’t have an answer right now. If I find one, I will either update this article or write a new one specifically for Xcode 9.

      You should try asking this question on Apple’s paid developer forums.

      https://forums.developer.apple.com/

      There’s a Performance Tools board in the Xcode section for questions about Instruments. An Apple engineer may have an answer for you.

Leave a Reply

Your email address will not be published. Required fields are marked *