The exact environment variables that control profiling depend on the type of profiling you're doing when running
an application from the command line.
For position sampling only, no environment variables need be set. For sampling with call counting, you need to set the
following variables:
- PROFDIR=dir — turn on data collection. The data is stored in a file at
dir/pid.program_name.
For example, if you run PROFDIR=/tmp ./myapp and the resulting process has PID
12345, the data would be available in /tmp/12345.myapp.
- QCONN_PROFILER=/dev/profiler — turn on data collection and send the data
to the /dev/profiler resource manager, which sends it to the IDE.
Use this option to attach to a process from the IDE.
When measuring function runtimes, the following environment variables affect application behavior:
- QPROF_START=0|1 — if set to 0, do not start profiling automatically; if set to 1,
start profiling automatically (i.e., as soon as the application starts running). The default is 1.
- QPROF_FILE=filepath — enable the profiler data capture process and write
the profiling results to the specified filepath. By default, profiling is turned off. To attach the
IDE to a running process, you must set this variable to
/tmp/program_name.ptrace.
- QPROF_KERNEL_TRACE=1 — use kernel trace events to log function runtimes instead of the
profiling instrumentation. When this variable is defined, QPROF_FILE must not be defined.
- QPROF_METHOD=0 — Use ClockCycles() for single-core and realtime clock
for multi-core (default).
- QPROF_METHOD=1 — Use ClockCycles() (fast, better resolution) for
multi-core; this requires threads to be bound to the same CPU.
- QPROF_METHOD=2 — Use the realtime clock.
- QPROF_METHOD=3 — Use the process time clock.
- QPROF_SIG_STOP_PROFILING=signum — install the stop profiling handler for the
signum signal. By default, it isn't installed. The recommended value is 15.
- QPROF_SIG_CONT_PROFILING=signum — install the resume profiling handler for the
signum handler. By default, it isn't installed. The recommended value is 16.
- QPROF_HELP=1 — print the profiler help and exit the application.