Changes between Version 5 and Version 6 of instruments
- Timestamp:
- 07/01/16 13:19:59 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
instruments
v5 v6 80 80 == Obtaining Useful Information from a Run == 81 81 82 As you might have noticed, there is nothing useful from the default view. In order to see what is happening, we need to change a few settings. To start, we click the gear icon located in the middle right hand side of the screen (next to an icon that looks like an 'E'). This shows us the display settings. Under the "Call Tree" options, we'''select''': `Separate by Thread`, `Invert Call Tree`, `Hide System Libraries`, and `Flatten Recursion`. Make sure that these are the '''only''' selected options.82 As you might have noticed, there is nothing useful from the default view. In order to see what is happening, we need to change a few settings. To start, click the gear icon located in the middle right hand side of the screen (next to an icon that looks like an 'E'). This shows us the display settings. Under the "Call Tree" options, '''select''': `Separate by Thread`, `Invert Call Tree`, `Hide System Libraries`, and `Flatten Recursion`. Make sure that these are the '''only''' selected options. 83 83 84 This will clean up ourview of the call tree and will only show relevant functions ordered by time (from highest to lowest). The image below shows all of the settings needed to obtain accurate information about what functions within ISSM take the most time. The first red rectangle highlights where the display settings icon is while the second red rectangle shows where the "Call Tree" options that need to be changed are.84 This will clean up the view of the call tree and will only show relevant functions ordered by time (from highest to lowest). The image below shows all of the settings needed to obtain accurate information about what functions within ISSM take the most time. The first red rectangle highlights where the display settings icon is while the second red rectangle shows where the "Call Tree" options that need to be changed are. 85 85 86 86 [[Image(http://i.imgur.com/j8kCtok.jpg)]] … … 88 88 == Call Tree Option Explanations == 89 89 90 From the previous section, we selected `Separate by Thread`, `Invert Call Tree`, `Hide System Libraries`, and `Flatten Recursion`. This section will explain the se options as well as the other options we did not select, and why we chose those options.90 From the previous section, we selected `Separate by Thread`, `Invert Call Tree`, `Hide System Libraries`, and `Flatten Recursion`. This section will explain the options that were selected and not selected. 91 91 92 92 === Separate by Thread === 93 For multi-threaded applications, or for applications that call a multi-threaded library, if turn this setting on, we will getto see what is executed under each thread during run time. This is left on by default, and is extremely useful for profiling multi-threaded applications or tests that might call multi-threaded functions.93 For multi-threaded applications, or for applications that call a multi-threaded library, turning this setting on allows us to see what is executed under each thread during run time. This is left on by default, and is extremely useful for profiling multi-threaded applications or tests that might call multi-threaded functions. 94 94 95 95 === Invert Call Tree === 96 This is probably the most important option you can enable if you want to find the most time-consuming functions. Within the call tree there is a `running time` column and a `self time` column. The running time displays a total running time for that function, including other functions that are called from that specific function. The self time will show youhow much time is actually spent inside the function, excluding other function calls.96 This is probably the most important option you can enable if you want to find the most time-consuming functions. Within the call tree there is a `running time` column and a `self time` column. The running time displays a total running time for that function, including other functions that are called from that specific function. The self time will displays how much time is actually spent inside the function, excluding other function calls. 97 97 98 For example, if `functionA()` spends 200ms before calling `functionB()`, and `functionB()` takes 400ms, then `functionA()` will have a running time of 600ms while `functionB()` only has a running time of 400ms. This makes it seem like `functionA()` takes the most time, but in reality `functionB()` is actually the slowest function. With invert call tree on we examine leaves of the call tree. This means that functions which do not call other functions are shown first. With this setting on, sorting by run time actually displays the correct run time and therefore gives us a better idea of what we can optimize.98 This concept can be better understood using the following example: If `functionA()` spends 200ms before calling `functionB()`, and `functionB()` takes 400ms, then `functionA()` will have a running time of 600ms while `functionB()` only has a running time of 400ms. This makes it seem like `functionA()` takes the most time, but in reality `functionB()` is actually the slowest function. With invert call tree on we examine leaves of the call tree. This means that functions which do not call other functions are shown first. With this setting on, sorting by run time actually displays the correct run time and therefore gives us a better idea of what we can optimize. 99 99 100 100 === Hide System Libraries === … … 108 108 === Top Functions === 109 109 110 This setting will order symbols and functions by running time. This option isn't needed because the results we use are already sorted by self time. Turning this one while `Invert Call Tree` is selected will only make the results of your profiling run harder to understand.110 This setting will order symbols and functions by total running time. This option isn't needed because the results we use are already sorted by self time. Turning this one while `Invert Call Tree` is selected will only make the results of your profiling run harder to understand. 111 111 112 112 == Inspecting Functions == 113 113 The power of Instruments is that you can see what takes the most time in a specific function. In order to do this, just double click on the function name you want to inspect further. Initially, when a function is selected, you will only be presented with an assembly view. This view shows all the assembly functions that take place when the code is executed. There is also a percentage next to an assembly routine that corresponds to a line of code within the function selected. 114 114 115 Since ISSM is not built with XCode, in order to view the corresponding source code relating to each assembly routine, we must locate the file we want to examine. To do this, select the "designate source" button to locate the file. This will look like a small red exclamation point. Select the file that contains the function you want to examine and then reload the view by going back to the original call tree and then clicking on the function again. The image below shows the steps to take to designate a source file for `MatrixMultiply()`, and the resulting view you should see.115 Since ISSM is not built with XCode, in order to view the corresponding source code relating to each assembly routine, we must locate the source file we want to examine. To do this, select the "designate source" button to locate the file. This will look like a small red exclamation point. Select the file that contains the function you want to examine and then reload the view by going back to the original call tree and then clicking on the function again. The image below shows the steps to take to designate a source file for `MatrixMultiply()`, and the resulting view you should see. 116 116 117 117 [[Image(http://i.imgur.com/ME8LzU8.jpg)]]