CPU Profiler control APIs allow user to limit the profiling scope to a specific portion of the code within the target application. Usually, when the profiling done, it captures the samples for the complete application, i.e. start of execution till end of the application execution. The control APIs can be used to enable the profiler only for a specific part of application, e.g. a CPU intensive loop, a hot function, etc. The target application need to be recompiled after adding the control APIs within the application.
The control APIs:
// To pause CPU profiling, call one of the below two APIs.
int amdtStopProfiling(amdtProfilingControlMode); // Set mode to AMDT_CPU_PROFILING
int amdtStopProfilingEx(void);
// To resume CPU profiling, call one of the below two APIs.
int amdtResumeProfiling(amdtProfilingControlMode); // Set mode to AMDT_CPU_PROFILING
int amdtResumeProfilingEx(void);
CPU Profiler only profiles the code within each Resume, Stop APIs pair. Refer “CPU Profiler Tutorial” on how to use these APIs, compile your target application and profile only the desired part of code.