Controlling profiling at runtime

You can configure the initial profiling settings through the Application Profiler in the IDE or through command-line settings. While an instrumented binary runs, you can further control profiling by using signals or API calls.

The exact capabilities of these two runtime control methods are as follows:
Signalling
If you installed signal handlers to dynamically control profiling, whether through the Application Profiler controls or environment variables on the command line, you can send signals to the instrumented binary to pause and resume profiling.
API calls
The libprofilingS library defines macros for pausing and resuming profiling. Your application code can call these macros to collect profiler data in specific regions only. It can also call functions to change the profiling mode and timer resolution, and to get backtraces.

You can use the Application Profiler or a command line to set the initial profiling behavior (details on doing so are given in the next subsection) but then use one or both runtime control methods to refine the profiling activity. Any adjustments made at runtime override any equivalent environment variable settings that were in effect when the program was launched.

Defining initial settings

The initial profiling settings are defined through environment variables. When you launch an application with profiling enabled from the IDE, the Application Profiler sets these variables based on its UI fields. For Functions Instrumentation mode, you can prevent profiling from automatically starting or define signals for pausing and resuming profiling activity, by setting the Control fields.

When launching applications outside of the IDE, you can set the environment variables ahead of time (e.g., in a setup script) or on the command line. The minimum variable settings needed to see profiling results are given in Running an instrumented application binary.