mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-30 15:21:04 +01:00
MINOR: cpu-topo: write thread-cpu bindings into trash buffer
Write thread-cpu bindings and cluster summary into provided trash buffer. Like this we can call this function in any place, when this info is needed.
This commit is contained in:
parent
2405283230
commit
9e11c852fe
@ -61,7 +61,7 @@ void cpu_topo_debug(const struct ha_cpu_topo *topo);
|
|||||||
/* Dump the summary of CPU topology <topo>, i.e. clusters info and thread-cpu
|
/* Dump the summary of CPU topology <topo>, i.e. clusters info and thread-cpu
|
||||||
* bindings.
|
* bindings.
|
||||||
*/
|
*/
|
||||||
void cpu_topo_dump_summary(const struct ha_cpu_topo *topo);
|
void cpu_topo_dump_summary(const struct ha_cpu_topo *topo, struct buffer *trash);
|
||||||
|
|
||||||
/* re-order a CPU topology array by locality to help form groups. */
|
/* re-order a CPU topology array by locality to help form groups. */
|
||||||
void cpu_reorder_by_locality(struct ha_cpu_topo *topo, int entries);
|
void cpu_reorder_by_locality(struct ha_cpu_topo *topo, int entries);
|
||||||
|
|||||||
@ -269,21 +269,21 @@ void cpu_topo_debug(const struct ha_cpu_topo *topo)
|
|||||||
/* Dump the summary of CPU topology <topo>: clusters info and thread-cpu
|
/* Dump the summary of CPU topology <topo>: clusters info and thread-cpu
|
||||||
* bindings.
|
* bindings.
|
||||||
*/
|
*/
|
||||||
void cpu_topo_dump_summary(const struct ha_cpu_topo *topo)
|
void cpu_topo_dump_summary(const struct ha_cpu_topo *topo, struct buffer *trash)
|
||||||
{
|
{
|
||||||
int cpu, grp, thr;
|
int cpu, grp, thr;
|
||||||
|
|
||||||
printf("CPU clusters:\n");
|
chunk_appendf(trash, "CPU clusters:\n");
|
||||||
for (cpu = 0; cpu < cpu_topo_maxcpus; cpu++) {
|
for (cpu = 0; cpu < cpu_topo_maxcpus; cpu++) {
|
||||||
if (!ha_cpu_clusters[cpu].nb_cpu)
|
if (!ha_cpu_clusters[cpu].nb_cpu)
|
||||||
continue;
|
continue;
|
||||||
printf(" %3u cpus=%3u cores=%3u capa=%u\n",
|
chunk_appendf(trash, " %3u cpus=%3u cores=%3u capa=%u\n",
|
||||||
cpu, ha_cpu_clusters[cpu].nb_cpu,
|
cpu, ha_cpu_clusters[cpu].nb_cpu,
|
||||||
ha_cpu_clusters[cpu].nb_cores,
|
ha_cpu_clusters[cpu].nb_cores,
|
||||||
ha_cpu_clusters[cpu].capa);
|
ha_cpu_clusters[cpu].capa);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Thread CPU Bindings:\n Tgrp/Thr Tid CPU set\n");
|
chunk_appendf(trash, "Thread CPU Bindings:\n Tgrp/Thr Tid CPU set\n");
|
||||||
for (grp = 0; grp < global.nbtgroups; grp++) {
|
for (grp = 0; grp < global.nbtgroups; grp++) {
|
||||||
int first, last;
|
int first, last;
|
||||||
int min, max;
|
int min, max;
|
||||||
@ -338,7 +338,7 @@ void cpu_topo_dump_summary(const struct ha_cpu_topo *topo)
|
|||||||
else if (len2 == 0)
|
else if (len2 == 0)
|
||||||
snprintf(str + len, sizeof(str) - len, "<all>");
|
snprintf(str + len, sizeof(str) - len, "<all>");
|
||||||
|
|
||||||
printf(" %s\n", str);
|
chunk_appendf(trash, " %s\n", str);
|
||||||
min = max = -1;
|
min = max = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1481,7 +1481,7 @@ int thread_map_to_groups()
|
|||||||
cpu_reorder_by_index(ha_cpu_topo, cpu_topo_maxcpus);
|
cpu_reorder_by_index(ha_cpu_topo, cpu_topo_maxcpus);
|
||||||
cpu_topo_debug(ha_cpu_topo);
|
cpu_topo_debug(ha_cpu_topo);
|
||||||
chunk_reset(&trash);
|
chunk_reset(&trash);
|
||||||
cpu_topo_dump_summary(ha_cpu_topo);
|
cpu_topo_dump_summary(ha_cpu_topo, &trash);
|
||||||
printf("%s\n", trash.area);
|
printf("%s\n", trash.area);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user