mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 01:14:38 +00:00
MINOR: cpuset: add cpu_map_configured() to know if a cpu-map was found
Since we'll soon want to adjust the "thread-groups" degree of freedom based on the presence of cpu-map, we first need to be able to detect if cpu-map was used. This function scans all cpu-map sets to detect if any is present, and returns true accordingly.
This commit is contained in:
parent
f034139bc0
commit
7134417613
@ -41,4 +41,9 @@ void ha_cpuset_assign(struct hap_cpuset *dst, struct hap_cpuset *src);
|
||||
*/
|
||||
int ha_cpuset_size(void);
|
||||
|
||||
/* Returns true if at least one cpu-map directive was configured, otherwise
|
||||
* false.
|
||||
*/
|
||||
int cpu_map_configured(void);
|
||||
|
||||
#endif /* _HAPROXY_CPUSET_H */
|
||||
|
17
src/cpuset.c
17
src/cpuset.c
@ -118,3 +118,20 @@ int ha_cpuset_size()
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Returns true if at least one cpu-map directive was configured, otherwise
|
||||
* false.
|
||||
*/
|
||||
int cpu_map_configured(void)
|
||||
{
|
||||
int grp, thr;
|
||||
|
||||
for (grp = 0; grp < MAX_TGROUPS; grp++) {
|
||||
if (ha_cpuset_count(&cpu_map[grp].proc))
|
||||
return 1;
|
||||
for (thr = 0; thr < MAX_THREADS_PER_GROUP; thr++)
|
||||
if (ha_cpuset_count(&cpu_map[grp].thread[thr]))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user