Calling the APIs

CodeXL

PreviousNext
CodeXL User Guide
Calling the APIs

Include the header file AMDTActivityLogger.h, and call the resume and pause APIs within the code. The code encapsulated within resume-pause API pair will be profiled by CPU Profiler.

These APIs can be called multiple times to profile different parts of the code.

These APIs can be spread across multiple functions, i.e. resume called from one function and stop called from another function.

These APIs can be spread across threads, i.e. resume called from one thread and stop called from another thread of the same target application.

In the below example, the CPU Profiler is restricted to the execution of multiply_matrices() function.

#include <AMDTActivityLogger.h>

 

int main(int argccharargv[])

{

    // Initialize the matrices

    printf("Initializing matrices\n");

    initialize_matrices();

 

    // Multiply the matrices

    printf("Multiplying matrices\n");

 

    // Resume the CPU profiler

    // amdtResumeProfiling(AMDT_CPU_PROFILING);

    amdtResumeProfilingEx();

 

    multiply_matrices();

 

    // Stop the CPU Profiler

    // amdtStopProfiling(AMDT_CPU_PROFILING);

    amdtStopProfilingEx();

 

    return 0;

}