C++ APIs - C++ APIs - 57368

uProf User Guide

Document_ID
57368
Release_Date
2025-06-09
Revision
5.1 English

To use C++ APIs, include the header AMDProfileController.h. Path of this header is: <Installation Directory>/include/AMDProfileController.h. Example: ~/Foo/Bar/AMDuProf_Linux_x64_5.0.775/include/AMDProfileController.h . Hence, that folder must be in the include path, while building the instrumented application.

For linking, the library, include the library path of libAMDProfileController.so, whose path is: <Installation Directory>/lib/x64/shared/libAMDProfileController.so

There are four C++ based APIs for supporting domain and task.

Table 1. C++ APIs
API and description Parameters Returns

void* amdDomainCreate(const char* name);

This function creates a domain with specified name "name" and returns the handle, as void pointer. If called multiple times within same scope, it returns the same handle.

const char* name: Name of the domain. It can contain space, period, etc. such as amd.com.uprof Handle as void* to the created domain.

unsigned long* amdStringHandleCreate(const char* name);

This function create the specified string "name", given in the argument and returns the handle, as unsigned long pointer.

const char* name: Name associated with the handle, which is used as task name. Handle as void* to the created string.

void amdTaskBegin(void* domainHandle, int taskId, int parentId, const long unsigned int*strHandleForTask);

Marks the beginning of the task in this domain.

  1. void* domainHandle: a valid domain handle created by amdDomainCreate(...).
  2. int taskId: currently, only 0 is to be passed for this.
  3. int parentId: currently, only 0 is to be passed for this.
  4. const long unsigned int*strHandleForTask: a valid string handle returned by amdStringHandleCreate(...).
Nothing

void amdTaskEnd(void* domainHandle);

Marks the end of the task, which was begun by latest(last) runtime call of amdTaskBegin(...) with same domain.

void* domainHandle: a valid domain handle created by amdDomainCreate(...). Nothing
Example
void *execDomain = amdDomainCreate ("Main.ExecuteBenchmark");
void *mulStr = amdStringHandleCreate ("MultiplyMatrices");
// some activities, not within task
int matrixSize =1000;
initialize_matrices(matrixSize); 
 
amdTaskBegin (execDomain, 0, 0, mulStr);
// some activities within task
multiply_matrices(1000);
printOutout();
amdTaskEnd (execDomain);
 
// some activities, not within task
CleanUp();