HTL_thread_executor_get_affinity
Obtains the CPU set bound to a specified executor.
Interface Definition
int HTL_thread_executor_get_affinity(HTL_thread_executor_t executor, int max_cpuids, int *cpuids, int *num_cpuids);
Description
HTL_thread_executor_get_affinity() is used to obtain the CPU set bound to a specified executor. If the executor is not bound to any CPU, cpuids will not be updated.
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
executor |
HTL_thread_executor_t |
Handle to the executor. |
Input |
max_cpuids |
int |
Maximum number of records that can be written to cpuids. |
Input |
cpuids |
int * |
CPU ID. |
Output |
num_cpuids |
int * |
Number of CPUs. |
Output |
Return Value
- HTL_THREAD_SUCCESS: success.
- Other values: failure. For details, see the error code descriptions.
Example
1 2 3 4 5 6 | cpuset_size = num_cpus; cpuset = (int *)malloc(cpuset_size * sizeof(int)); num_cpus = 0; HTL_thread_executor_t self_executor; ret = HTL_self_get_xstream(&self_executor); ret = HTL_thread_executor_get_affinity(self_executor, cpuset_size, cpuset, &num_cpus); |
Parent topic: Executor Functions