Difference between revisions of "How to use ''Instruments'' on OS/X to profile"

From OPeNDAP Documentation
m (Running instruments)
m (Running instruments)
 
Line 6: Line 6:
 
== Running ''instruments'' ==
 
== Running ''instruments'' ==
 
Once the ''<name>.dSYM'' directories are built, run the instruments GUI and:
 
Once the ''<name>.dSYM'' directories are built, run the instruments GUI and:
# Click the menu to ''Choose Target...'' [[File:Choose Target.png|frame|200px]]
+
# Click the menu to ''Choose Target...'' [[File:Choose Target.png|500px]]
# Navigate to the program to run - yes, it's tedious. [[File:ChooseProgram.png]]
+
# Navigate to the program to run - yes, it's tedious. [[File:ChooseProgram.png|500px]]
 
## Choose the program (note that the dSYM dir is there too)
 
## Choose the program (note that the dSYM dir is there too)
 
## provide the arguments to the program
 
## provide the arguments to the program
Line 13: Line 13:
  
 
=== The red dot ===
 
=== The red dot ===
Now click the 'Run' button (the red dot) [[File:TheRedDot.png]]
+
Now click the 'Run' button (the red dot) [[File:TheRedDot.png|500px]]
  
Here's the result [[File:ItRuns.png]]
+
Here's the result [[File:ItRuns.png|500px]]
  
Click to expand (and click the arrow in the circle to examine a sub-hierarchy of calls) [[File:ExpandCalls.png]]
+
Click to expand (and click the arrow in the circle to examine a sub-hierarchy of calls) [[File:ExpandCalls.png|500px]]

Latest revision as of 20:06, 17 August 2018

The instruments profiles can be run from the command line, but it doesn't seem to pick up the symbols for the executables when run that way with Xcode 9. Here's how to fix that.

1 Building symbols

Even though executables are built using -g3 -O0, OS/X clang/gcc dies not include those symbols in binary images built by the linker. To make that info available to instruments, use the program dsymutil on the executable, .dylib and/or .so. This may be an iterative process; see the next section.

2 Running instruments

Once the <name>.dSYM directories are built, run the instruments GUI and:

  1. Click the menu to Choose Target... Choose Target.png
  2. Navigate to the program to run - yes, it's tedious. ChooseProgram.png
    1. Choose the program (note that the dSYM dir is there too)
    2. provide the arguments to the program
    3. and, below that, the full path to the working directory.

2.1 The red dot

Now click the 'Run' button (the red dot) TheRedDot.png

Here's the result ItRuns.png

Click to expand (and click the arrow in the circle to examine a sub-hierarchy of calls) ExpandCalls.png