Resource Monitoring APIs
This section describes the APIs for querying the TA CPU and memory usage.
- Obtain the CPU usage.
int SDF_GetCpuUsage(void *hSessionHandle, double *pdCpuUsage);
Table 1 Parameter description Parameter
Description
hDeviceHandle[in]
Handle of the device that has been started.
pdCpuUsage[out]
CPU usage.
Table 2 Return values Return Value
Description
0
Success
Other values
Failure: returning an error code
1. This API collects statistics on the TA CPU usage by process.
2. Each service thread of the TA is bound to all cores of the specified CPU. To optimize performance and resource utilization, you are advised to set the number of service threads to the number of bound CPU cores.
3. The CPU cores to be bound can be set in the related configuration file.
- Obtain the memory usage.
int SDF_GetMemUsage(void *hSessionHandle, double *pdMemUsage);
Table 3 Parameter description Parameter
Description
hDeviceHandle[in]
Handle of the device that has been started.
pdMemUsage[out]
Memory usage.
Table 4 Return values Return Value
Description
0
Success
Other values
Failure: returning an error code