9

Is there any way to compare trace files saved with Instruments. How can I have a comparison of any way regarding consecutive realise builds of the app.

Lest's say I release iPhone app version 1.0 then in 2 months 1.1. What's is the best have to have a profiling comparison in terms of memory and time?

user3017495
  • 123
  • 5

2 Answers2

3

You can save trace files. But to make is reasonable to interpret those results at a future date, it's useful to insert "flags" in your trace, to mark significant events, so that you can tell what the app was doing at notable points in the trace.

In the past, I'd suggest the inclusion of flags inserted programmatically, so you have some basis for comparison in the future, but this is broken in iOS7. But if you're running this on the simulator with iOS prior to 7.0, you can:

  • Add DTPerformanceSession.framework to your project;

  • In your source:

    #import <DTPerformanceSession/DTSignalFlag.h>
    
  • Then, in your source, you can programmatically insert flags in Instruments (when running on pre iOS7 simulator):

    // Point flag (just an event in time)
    DTSendSignalFlag("some event", DT_POINT_SIGNAL, TRUE);
    
    // Start flag (to mark the start of something)
    DTSendSignalFlag("start some intensive process", DT_START_SIGNAL, TRUE);
    
    // End flag (to mark the end of something)
    DTSendSignalFlag("end some intensive process", DT_END_SIGNAL, TRUE);
    
  • Remove DTPerformanceSession.framework from your project (the process of adding it let Xcode resolve the header, but you don't want to keep it in your iOS project or else you'll get linking errors).

You might want to keep a copy of the respective archives so that you can resymbolicate the trace file at some future date.

Obviously, if profiling in iOS7, you can add flags yourself, manually, but it's just not as elegant or rigorous as flagging programmatically.

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • Thanks for the reply, unfortunately my application is iOS 7 only. What you are saying is that in order to see the trace difference, I have to manually look into the trace content of those consecutive builds. Isn't there an "automated comparison diff" for the trace files. Otherwise keeping track of memory and time profiling seems to be possible only manually. – user3017495 Nov 29 '13 at 07:00
  • After you do this, you need to go to Window > Manage Flags, and then choose to display Signal Flags, or else you won't see them – Dov Dec 09 '14 at 20:58
  • In later OS versions, we can now use "points of interest". http://stackoverflow.com/a/39416673/1271826 – Rob Sep 09 '16 at 18:40
2

The best way, that I figure out is:

  1. Install both versions of App to device
  2. Open Instruments.
  3. Click "Library" button and add that you want to track. For me it looks like that:

    • Activity monitor
    • Allocations
    • Time Profiler
    • Network Activity
    • Memory Monitor
  4. Choose as a target your iOS device. Then your application to test.

  5. Run serially the same scenario on both versions of app.
  6. Now you can see comparison for your 2 similar runs.
  7. Just click at any row to see details of the run.

I'm still looking for the ways, how to automate this steps and get some main review automatically. But now it's best way, that I know.

Hope it helps.

For me it looks like that:

xcode-instruments-trace-comparison

skywinder
  • 21,291
  • 15
  • 93
  • 123