Postmortem profiling for Call Count and sampling

Postmortem profiling lets you profile your application (the data generated by the profiling process) at a later time. The IDE lets you profile your program after it terminates, using the traditional gmon.out file; however, postmortem profiling doesn't provide as much information as profiling a running process because:


Profiling a gmon.out file involves these basic steps:


Gathering profiling information

To gather profiling information in a gmon.out file, you need to specify the PROFDIR environment variable before launching your application.

If you're launching from the command line, type the following:

PROFDIR=/tmp ./appname

To launch from the IDE:


  1. Create a launch configuration for a debuggable executable as you normally would, but don't click Run or Debug.
    Note: You must have the QNX Application Profiler tool disabled in your launch configuration.
  2. Click the Tools tab and deselect the Application Profiler tool, and click OK.
  3. Select the Environment tab.
  4. Click New.
  5. In the Name field, type PROFDIR.
  6. In the Value field, enter a valid path to a directory on your target machine.
    Note: This path must be a valid location on the target machine; otherwise, you'll receive a warning message indicating that the IDE was unable to open the gmon.out file for output.
  7. Click OK.
  8. Run your program. When your program exits successfully, it creates a new file in the directory you specified. The filename format is pid.fileName (e.g. 3047466.helloworld_g). This is the gmon.out profiler data file.

Transferring a file

You can import .gmon, .kev, .ptrace, or .xml data files using the Import action from the session view, or using the Import wizard:


  1. Open the Target File System Navigator view ( Window > Show View > Other… > QNX Targets > Target File System Navigator ).
  2. In the Target File System Navigator view, right-click your file and select Copy to… > Workspace . The Select target folder dialog appears.
  3. Select the project related to your program.
  4. Click OK.
  5. In the Project Explorer view, right-click your file and select Import into QNX Application Profiler. The Program Selection dialog appears.
  6. Select the binary that generated the file.
  7. Click OK. You can now profile your program in the QNX Application Profiler perspective.
Related concepts
Building a program for profiling
Application Profiler tab
Related tasks
Running and profiling a process
Profiling a running process