Running an instrumented binary with profiling from a command prompt (Function Instrumentation mode)

To run an instrumented binary with profiling from the command prompt:
  1. To start the Application Profiler immediately after the application starts, set environment variable QPROF_AUTO_START:
    QPROF_AUTO_START=1 
  2. To redirect the gmon output to a file, set the environment variable: QPROF_FILE
    QPROF_FILE=/tmp/myapp.ptrace 
  3. To change to kernel trace logging, set the environment variable QPROF_KERNEL_TRACE=1:
  4. To include the shared library path used for profiling, set the environment variable LD_LIBRARY_PATH:
    LD_LIBRARY_PATH=.../profiling_lib:$LD_LIBRARY_PATH 
  5. To run the application, set the following:
    QPROF_AUTO_START=1 QPROF_FILE=/tmp/myapp.ptrace \
    LD_LIBRARY_PATH=.../profiling_lib:$LD_LIBRARY_PATH ./myapp 
Related concepts
Using Function Instrumentation with the Application Profiler
Using Sampling and Call Count instrumentation mode
Using Function Instrumentation mode for a single application
Using Function Instrumentation in the System Profiler
Comparing profiles
Related tasks
Creating an Application Profiler session
Creating a profiler session by importing profiler data
Profiling a single-threaded application
Profiling a running process for an existing project
Using postmortem profiling for Call Count and Sampling
Postmortem profiling
Taking a snapshot of a profiling session