Re: Distinguish real vs. virtual CPUs?

From: Dr. David Alan Gilbert
Date: Tue Mar 22 2005 - 06:56:54 EST


* Dave Jones (davej@xxxxxxxxxx) wrote:
> Compare the 'physical id' fields of /proc/cpuinfo, and count
> how many unique values you get.
> Ie, on my dual+ht, I see..
>
> physical id : 0
> physical id : 0
> physical id : 3
> physical id : 3
>
> Which indicates 2 real CPUs split in two.

Is this guarenteed to be safe on all architectures? Parsing
/proc/cpuinfo accross different architectures can be a bit hairy;
I'm thinking when non-x86 start to have multiple hardware threads
people might want to do the same thing.

Dave
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \
\ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/