Using postmortem profiling for Call Count and Sampling
You can change the configuration options to profile an application to capture performance
information whereby profiling is done by code linked into the process, and after the
process exits normally (without error). Data, which is the function information (such as
call counts, callers, and statistics), is written to a file that you can then load into
the IDE.
To configure postmortem profiling:
- In the Project Explorer view, right-click your project and select
Properties.
- In the left pane, select QNX C/C++ project.
- In the right pane, select the Options tab.
- Select Build for Profiling (Call Count).
- Select the Build Variants tab and select the
Debug variant for your target(s).
- Click OK.
- When prompted, click Yes to rebuild your project.
- Create a launch configuration for a debuggable executable.
- Select the Environment tab.
Profiling information is
written to a file in the location you specify with the
PROFDIR environment variable. If you don't set
PROFDIR, the information is written to a file called
gmon.out in the directory the process was run from.
- In the Name field, type PROFDIR.
- In the Value field. Type a valid path to a directory on your
target machine, (i.e. /tmp).
- Click OK.
- Run the program.
- When the execution finishes, import a data file, such as
gmon.out, by doing the following:
- Select .
- In the Select target folder dialog, select the project related to your
program.
- Click OK.
- In the Project Explorer view, right-click the imported file and rename it, i.e. to
gmon.out.
- To start a postmortem profiling session, do the following:
- In the Project Explorer view, right-click on the file
gmon.out and select the
Import/Open action in the QNX Application
Profiler.
- In the Import from gmon.out file window, browse to set
the location of the executable file.
- Click Finish.
Now, you can begin to analyze the profiler data.