Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
wiki1737: IDE4.5ApplicationProfilerTrial (Version 9)

Application Profiler in IDE 4.5: Installation and Usage Instructions#

IDE4.5ApplicationProfilerTrial/et_diff.png

Installation#

  • Install Momentics 6.3.2 on the host machine (Windows or Linux). Probably would work on any other 6.3 or 6.4 SDK you have.
  • Install latest IDE 4.5 on host machine from http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/Builds_Tau_Integration or if you have it already installed, install latest updates for IDE 4.5 from update site: https://www.qnx.com/account/updates/foundry27/ide/tau (see below how), update from IDE 4.0.1 would not work, you have to install new IDE from a zip first.
    • To install full IDE 4.5 from a .zip file pick one archive for your host platform from location above
    • Download it and unzip where you want. This would be your IDE 4.5 installation directory.
    • Run IDE: execute qde from the IDE installation directory.
  • To use update site
    • Open Help->Software Updates->Find and Install...
    • Select Search for new features to install. Click Finish.
    • Click New Remote Site and enter URL (https://www.qnx.com/account/updates/foundry27/ide/tau) and name "IDE 4.5 Integration builds update site".
    • Select this site. Click Finish.
    • Select All Features. Click Finish. Select Install All. Restart IDE.

Build & Launch#

Sampling Mode #

Sampling is original mode of old Application Profiler, you still can use it. To use basic sampling no recompilation is required. If you want to use calls count instrumentation see below. This mode won't give you precise function times and you rely on the fact the application is running for a long time. It would be almost the same as old profiler except a little bit better editor annotations and compare session support.

Builds Flags#

  • For Makefile use option -p for compiling and linking
  • For Qnx projects
    • Open Project context menu, select Properties->Qnx C/C++ Project->Options tab
    • Select "Build for Profiling (Call Count Instrumentation)"
  • For Manged Project with QNX toolchain
    • Open Project context menu, select Properties->C/C++ Build->Settinfs->Tools settings->QCC Compiler->Output Control
      • Enable "Call Count Profiling (-p)"
    • Select QCC Linker->Output Control
      • Enable "Call Count Profiling (-p)"

Launch from IDE#

  • Create a launch configuration for your application, add Tools->QNX Application Profiler from Tools tab
  • Select Sampling and Call Count Instrumentation
  • Select Single Application
  • Check Switch to this tool Perspective after launch

You application would start as well as Application Profiler monitor, Application Profiler perspective would open and Execution Time would would show data from current session with automatic refresh enabled.

Function Instrumentation Mode for Single Application#

This method allow to get precise functions execution time. It better works for one thread, because with many threads overhead of such measurement can change application behavior.

Build Flags#

  • For Qnx projects
    • Open Project context menu, select Properties->Qnx C/C++ Project->Options tab
    • Select "Build for Profiling (Function Instrumentation)"
  • For Manged Project with QNX toolchain
    • Open Project context menu, select Properties->C/C++ Build->Settinfs->Tools settings->QCC Compiler->Ouput Control
      • Enable "Function Instrumentation Profiling (-finstrument-functions)"
    • Select QCC Linker->Output Control
      • Enable "Function Instrumentation Profiling (-lprofilingS)"
  • If you using Makefile
    • to compile application/library with instrumentation add option -finstrument-functions
    • to link add option -lprofilingS (see Installation section above to install this library)

Launch from IDE #

  • Assuming you have your code as IDE Project and binary/library located there
  • Create new Launch configuration
  • In Tools tab select Add Tools... and select QNX Application Profiler
  • Select Function Instrumentation (NOT Sampling)
  • Select Single Application
  • Click Apply and Run.
  • If process does not finish itself, you have to kill it because this would be sign to IDE to download data (if you don't use mode "Update while running").
  • Instead of terminating process you can just terminate QNX Application Profiler service in the Debug view, it will download current state of data.
  • Please note: this version is not optimized for data transfer. Each second of application running can generate up to 2Mb of data.

Launch from Command line on target #

To launch on target:
  • set QPROF_FILE env var to /tmp/profiler.ptrace (does not really matter what file, but matter where is it - it can be huge)
  • launch binary, perform test and stop it after some time, because trace cannot hold more than several seconds, minutes at most.
  • In IDE. Copy file $QPROF_FILE into IDE workspace (into target project for example) using Target File System Navigator view.
  • Switch to "Application Profiler" perspective
  • In Profiler Session view select action Import
  • Follow import wizard and specify binary and shared libraries paths. If binary was not compiled on the same host you need to edit source path tab to add source search path or mapping between compiled code location and location of the sources on the host.
  • Click Finish. IDE would create a session and automatically select it.

Function Instrumentation Mode for System Profiler#

If you want to see functions names in System Profiler timeline view you may want to consider adding this information by Instrumenting you binaries with Function instrumentation library and running in kernel events mode.

Build Flags#

  • Use instructions from section above to build one or more binaries/libraries with -finstrument-functions

Launch from Command line on target#

  • set environment variable QPROF_KERNEL_TRACE=1 (for each process or export it for all processes. It won't affect non instrumented binaries)
  • launch one or more processes or target
  • In IDE open System Profiler perspective and run Kernel Logging for several seconds
  • Open resulting .kev file in System Profiler editor
  • Additionally you can import .kev file into Application Profiling from Profiler Session view or using standard File->Import dialog

Launch from IDE#

  • If you want to profile process right after the start, first create a launch configuration for the binary
  • In Tools tab select Add Tools... and select QNX Application Profiler AND select Kernel Logging
  • In Application Profiler tab
    • Select Function Instrumentation (NOT Sampling)
    • Select System Wide
    • De-select Switch to this tool's perspective on launch if selected
    • Click Apply
  • Switch to Kernel Logging tab
    • Enable "Launch with Kernel Log capturing"
    • Select one of existing System Profiler Kernel Log configurations.
      • If you don't have any, first save you current launch configuration, then select edit and create one. Make sure target selected for kernel mode is the same as target select for launch configuration.
    • Select Switch to this tool's perspective on launch if not selected
    • Click Apply
  • Open Upload tab or Launch configuration
    • De-select Use unique name (for uploaded binary)
    • Click Apply
  • Click Run

Analyzing Data #

Application Profiler#

It should be self explanatory in most of the cases.

There is an feature description article at: What is New in Application Profiler

System Profiler#

Please check this page: Usage of Function Instrumentation in System Profiler

If you have any questions or feedback, post into the ide forum.

Attachments:
Image et_diff.png [IDE4.5ApplicationProfilerTrial/et_diff.png]