Count the number of physical CPUs too

This commit is contained in:
Rodrigo Arias 2023-03-23 17:38:58 +01:00 committed by Rodrigo Arias Mallo
parent 2c09e40c44
commit 266b1638d4
2 changed files with 6 additions and 1 deletions

View File

@ -297,8 +297,12 @@ init_global_indices(struct system *sys)
thread_set_gindex(t, sys->nthreads++);
sys->ncpus = 0;
for (struct cpu *c = sys->cpus; c; c = c->next)
sys->nphycpus = 0;
for (struct cpu *c = sys->cpus; c; c = c->next) {
cpu_set_gindex(c, sys->ncpus++);
if (!c->is_virtual)
sys->nphycpus++;
}
}
static int

View File

@ -27,6 +27,7 @@ struct system {
size_t nthreads;
size_t nprocs;
size_t ncpus; /* Including virtual cpus */
size_t nphycpus;
struct loom *looms;
struct proc *procs;