Timering

Purp

Instruments tutorial Part 2 - Navigate Timeline Pane, Detail Pane, Hide System Library

After 1. Part of this series, you can now, what is Instruments, how it works, how can you launch it and what type of analysis can you make with that. Now I'll show you, how can you use the Navigate Timeline Pane and Detail Pane. How can you hide system libraries, add flags to your Timeline at serious points, or add new Instrument to it, or check the source code in Xcode, which causes problems. 

Steps

  1. Record a Trace
  2. Toolbar - Strategy buttons
  3. Detail Pane - Inspector Pane - Hide System Library
  4. Timeline Pane - Select a Range, Zoom in, Zoom out, Add Flags
  5. Check the Xcode source code of the analyzed data

Part of the series

  1. Instruments tutorial Part 1 - Profiling templates, deferred mode, launch instruments
  2. Instruments tutorial Part 3 - Profile Performance - CPU Usage - Time Profiler
  3. Instruments tutorial Part 4 - Profile Performance - Graphics Performance - Core Animation, OpenGl Activity
  4. Instruments tutorial Part 5 - Profile Performance - Monitor NetWork - Network
  5. Instruments tutorial Part 6 - Profile Memory - Activity Monitor
  6. Instruments tutorial Part 7 - Profile Memory - Allocations
  7. Instruments tutorial Part 8 - Profile Memory - Leaks
  8. Instruments tutorial Part 9 - Profile Memory - Zombies
  9. Instruments tutorial Part 10 - Profile Energy - Energy Impact
  10. Instruments tutorial Part 11 - Create Custom Instrument
  11. Instruments tutorial Part 12 - Automate UI Testing

Video

1. Record a Trace

At first step you need to recording what you are actually doing with your application in your Simulator or on your Device. For the best results, it's better to use on your device that will be real data. And as I've mentioned in the first part of this series, you can use "deffered mode" to get more accurate data. (However, if you need to check the results and the process live, you don't need to use it. It depends on your app, and what would you like to check exactly.)

Click on the Red button, do your staff in your app. Try to check at first just one action, and repeat it 3-5-7 times. After that, you can stop the recording, and see the results. If there are some problems with your code, you will see at your trace some significant high results. And if you've repeated the same action, you can see the same high values at every time, when you are doing the same action. However, first just see the whole Instruments, and start to use it.

Instruments part 2 recorded trace

I use for this tutorial my earlier Core Data iCloud Sync tutorial Xcode Project. You can reach it here: iCloud Sync tutorial Part 1/2 - create iCloudStore, check if user is Signed in, migrate store

2. Toolbar - Strategy buttons

Instruments part 2 Toolbar

At Toolbar, you can reach the 3 Strategy buttons, the "CPU", the "Instruments", and the "Threads". These are very useful. With "CPU" you can see the Cores, with "Threads" you can see all threads which were used during the time of recording. At "Instruments" you can see the data at the timeline pane.  

Instruments 2 Cores screen

Instruments 2 threads

With "View Buttons" you can hide or show the detail pane and inspector.

With "+" button, you can add another Instrument from the Library to your Trace Document. 

Instruments 2 add instrument library

3. Detail Pane - Inspector Pane - Hide System Library

3.1 At Detail Pane you can see your selected Instrument's data 

Instruments 2 inspector pane navigation bar

3.2. At "Instpector Pane" you can modify "Recording settings", "Display Settings", and you can reach "Extended Detail". 

Instruments 2 Inspector Pane Recording Settings good

Instruments 2 Inspector Pane Display Settings

At Display Settings, you should tick "Hide System Library" -and you can see clearly! ;)

Instruments 2 Inspector Pane Details

At "Extended Detail", you can see which part of your code detected. You can click on it to see your source code details. However, better first select a Range. 

You can find every little settings opportunity in Instruments UserGuide.

4. Timeline Pane - Select a Range, Zoom in, Zoom out, Add Flags

Zoom in: with pinch Trackpad, or with Option key and drag the section on timeline Pane. (watch video) From View menu - Increase Deck Size

Zoom out: with Command key and drag the section on timeline Pane. (watch video)  From View menu - Decrease Deck Size

Instruments_2_zoom in screenshot

Select Range: Drag across a section of data without using any modifier keys. Only the data you drag across is displayed.

Instruments_2_select_range

Add Flags: With cmd + down arrow, you can add flag for later quickly reach that points. You can add different name for the flags, and in flags palette you can manage them. 

instruments 2 add flag

5. Check the Xcode source code of the analyzed data 

At Inspector Pane at "Extended Details" you can see your source code block name, and if you click on it, you can see in Instruments your code, and which part of code cause the problem (usually we search codes of big CPU usage or Allocation issues). 

instruments 1 extended details check source

You can see which part of code needs to more time to load. Of course there are many other ways to check your code, depends on your selected Instrument and type of issues, and type of App. I'll present some of useful method in the next series.
Here you can click on the Xcode little icon and Xcode Project open at that point where your code is.  

Instruments 2 extended details xcode source code

Next

 The next part of the series: Instruments tutorial Part 3 - Profile Performance - CPU Usage - Time Profiler

Share & Follow

If you would like to be notified of my new solutions, please subscribe to my Newsletter or my youtube channel and/ or follow me on Facebook or Twitter! Check Footer section for these opportunities!