September 28th, 2015
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:
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.
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: xcode 7