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: 
            
         
         
         
            - multithreaded processes aren't supported by this mode, so the totals of all your program's threads are combined as one thread
               
            
 
            - call-pair information from shared libraries and DLLs isn't shown
 
         
         
         
         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: 
         
         
            - 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.
               
               
             
            - Click the Tools tab and deselect the Application Profiler tool, and click OK. 
            
 
            - Select the Environment tab. 
            
 
            - Click New.
            
 
            - In the Name field, type PROFDIR.
            
 
            - 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.
               
               
             
            - Click OK. 
            
 
            - 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: 
            
            
            
            
            
            
            
            
            
            
            
         
         
         
            - Open the Target File System Navigator view (). 
            
 
            - In the Target File System Navigator view, right-click your file and select . The Select target folder dialog appears. 
            
 
            - Select the project related to your program. 
 
            - Click OK. 
            
 
            - In the Project Explorer view, right-click your file and select Import into QNX Application Profiler. The Program Selection dialog appears.
               
               
            
 
            - Select the binary that generated the file. 
 
            - Click OK. You can now profile your program in the QNX Application Profiler perspective.