Attaching Application Profiler to a running process

Updated: April 19, 2023

If you want to start seeing function runtimes and call counts for a running process, you can attach the Application Profiler tool. The IDE then displays the profiling data received from the instrumented binary running on the target.

Note: The application that you want to profile must have been built with profiling instrumentation, either for sampling execution positions or measuring function runtimes, then run from the command line. Also, your host machine must have an IP connection to your target machine.
To attach the Application Profiler to a running process:
  1. In the launch bar, expand the Launch Configuration dropdown (which is in the middle) and select the application for which you want to see profiling data.
  2. In the Launch Target dropdown (on the right), select the target on which the application is running.
  3. In the Launch Mode dropdown (on the left), select Attach.
  4. Click the Edit button (Icon: Edit button) on the right of the Launch Configuration dropdown.
  5. Enable the Application Profiler in the launch configuration:
    1. Click the Tools tab on the right.
    2. Click the Application Profiler radio button.
    3. Ensure that the Profiling Method selection matches the instrumentation used by the application.
    4. Optional: If needed, configure other tool settings to customize how data are transferred to the IDE and which signals are used to start and stop profiling.
      Based on these settings, the Application Profiler will modify how the application is behaving when it's attached to the application process.
    5. Optional: Enable or disable other analysis tools.
      CAUTION:
      Don't enable the debugger when attaching the profiling tool. Stopping at breakpoints and stepping through code makes the function runtimes completely inaccurate. You should therefore ensure the debugger checkbox is unchecked at the top of the Debug tab.

      If you chose a Profiling Scope of System Wide, you must also run the System Profiler by checking this tool's box at the bottom of the Tools tab. This makes the IDE perform a kernel event trace while gathering profiling data.

  6. When you've finished configuring the tools, click OK to save the changes and exit the window.
  7. Click the Attach button (Icon: Attach button).
    The IDE switches to the Debug perspective if the debugger is enabled, or the QNX Analysis perspective if it's not, then opens the Select Process popup window. This window lists the processes with the same name as the binary specified in the Main tab.
  8. Click the process that you want to attach to, then click OK.

The IDE attaches the Application Profiler and any other enabled tools to the selected process. In the current perspective, you'll see a new session for storing the debugging or profiling results. Depending on the active tools and their configuration, these results might get updated as the program runs.

In the QNX Analysis perspective, you can see the function runtimes and call counts in the Execution Time view. The Application Profiler reference explains how to interpret the results.