GNU libmicrohttpd 1.0.0
|
Implementation of functions to detect the number of available CPU cores. More...
Go to the source code of this file.
Macros | |
#define | CPU_SETSIZE (1024) |
#define | CPU_SETSIZE_SAFE (64) |
Functions | |
static int | mhd_tool_get_sys_cpu_count_sysctl_ (void) |
static int | mhd_tool_get_proc_cpu_count_sched_getaffinity_ (void) |
static int | mhd_tool_get_proc_cpu_count_cpuset_getaffinity_ (void) |
static int | mhd_tool_get_proc_cpu_count_sched_getaffinity_np_ (void) |
static int | mhd_tool_get_proc_cpu_count_w32_ (void) |
int | mhd_tool_get_proc_cpu_count (void) |
static int | mhd_tool_get_sys_cpu_count_special_api_ (void) |
static int | mhd_tool_get_sys_cpu_count_sysctl_fallback_ (void) |
static int | mhd_tool_get_sys_cpu_count_sysconf_ (void) |
static int | mhd_tool_get_sys_cpu_count_sysconf_fallback_ (void) |
int | mhd_tool_get_system_cpu_count (void) |
Implementation of functions to detect the number of available CPU cores.
Definition in file mhd_tool_get_cpu_count.c.
#define CPU_SETSIZE (1024) |
Definition at line 78 of file mhd_tool_get_cpu_count.c.
#define CPU_SETSIZE_SAFE (64) |
Definition at line 79 of file mhd_tool_get_cpu_count.c.
int mhd_tool_get_proc_cpu_count | ( | void | ) |
Detect the number of logical CPU cores available for the process. The number of cores available for this process could be different from value of cores available on the system. The OS may have limit on number assigned/allowed cores for single process and process may have limited CPU affinity.
Definition at line 524 of file mhd_tool_get_cpu_count.c.
References mhd_tool_get_proc_cpu_count_cpuset_getaffinity_(), mhd_tool_get_proc_cpu_count_sched_getaffinity_(), mhd_tool_get_proc_cpu_count_sched_getaffinity_np_(), and mhd_tool_get_proc_cpu_count_w32_().
Referenced by mhd_tool_get_system_cpu_count().
|
static |
Detect the number of logical CPU cores available for the process by cpuset_getaffinity() function.
Definition at line 192 of file mhd_tool_get_cpu_count.c.
References CPU_SETSIZE, CPU_SETSIZE_SAFE, and NULL.
Referenced by mhd_tool_get_proc_cpu_count().
|
static |
Detect the number of logical CPU cores available for the process by sched_getaffinity() (and related) function.
Definition at line 129 of file mhd_tool_get_cpu_count.c.
References CPU_SETSIZE, CPU_SETSIZE_SAFE, and NULL.
Referenced by mhd_tool_get_proc_cpu_count().
|
static |
Detect the number of logical CPU cores available for the process by sched_getaffinity_np() (and related) function.
Definition at line 259 of file mhd_tool_get_cpu_count.c.
References mhd_tool_get_sys_cpu_count_sysctl_(), and NULL.
Referenced by mhd_tool_get_proc_cpu_count().
|
static |
Detect the number of logical CPU cores available for the process by W32 API functions.
Definition at line 324 of file mhd_tool_get_cpu_count.c.
References NULL.
Referenced by mhd_tool_get_proc_cpu_count().
|
static |
Detect the number of processors by special API functions
Definition at line 569 of file mhd_tool_get_cpu_count.c.
References NULL.
Referenced by mhd_tool_get_system_cpu_count().
|
static |
Detect the number of processors by sysconf() function in reliable way.
This function uses reliable identificators that coreponds to actual number of CPU cores online currently.
Definition at line 812 of file mhd_tool_get_cpu_count.c.
Referenced by mhd_tool_get_system_cpu_count().
|
static |
Detect the number of processors by sysconf() function, using fallback way.
This function uses less reliable (compared to mhd_tool_get_sys_cpu_count_sysconf_()) ways to detect the number of available CPU cores and may return values corresponding to the number of physically available (but possibly not used by the kernel) CPU logical cores.
Definition at line 848 of file mhd_tool_get_cpu_count.c.
Referenced by mhd_tool_get_system_cpu_count().
|
static |
Detect the number of processors by sysctl*() functions in reliable way.
This function uses reliable identificators that coreponds to actual number of CPU cores online currently.
Definition at line 668 of file mhd_tool_get_cpu_count.c.
References NULL.
Referenced by mhd_tool_get_proc_cpu_count_sched_getaffinity_np_(), and mhd_tool_get_system_cpu_count().
|
static |
Detect the number of processors by sysctl*() functions, using fallback way.
This function uses less reliable (compared to mhd_tool_get_sys_cpu_count_sysctl_()) ways to detect the number of available CPU cores and may return values corresponding to the number of physically available (but possibly not used by the kernel) CPU logical cores.
Definition at line 766 of file mhd_tool_get_cpu_count.c.
References NULL.
Referenced by mhd_tool_get_system_cpu_count().
int mhd_tool_get_system_cpu_count | ( | void | ) |
Try to detect the number of logical CPU cores available for the system. The number of available logical CPU cores could be changed any time due to CPU hotplug.
Definition at line 881 of file mhd_tool_get_cpu_count.c.
References mhd_tool_get_proc_cpu_count(), mhd_tool_get_sys_cpu_count_special_api_(), mhd_tool_get_sys_cpu_count_sysconf_(), mhd_tool_get_sys_cpu_count_sysconf_fallback_(), mhd_tool_get_sys_cpu_count_sysctl_(), and mhd_tool_get_sys_cpu_count_sysctl_fallback_().