[ILUG] Hyperthreading question
Pádraig Brady
P at draigBrady.com
Tue Feb 9 11:54:30 GMT 2010
On 09/02/10 11:32, Robert Sweetnam wrote:
> On 09/02/2010 11:34, Oliver Pfaff wrote:
>> Hi,
>>
>> At OS level on Linux, without installing an extra program, is it possible
>> to identify whether hyperthreading is activated on a Xeon CPU without
>> knowledge about the CPU design or hardware?
>>
>> Regards,
>>
>> Oliver.
>>
>
> Hi,
>
> cat /proc/cpuinfo
>
> Look for 'ht' in the flags.
Nope, that just means it has certain instructions available.
You could determine from counts in /proc/cpuinfo I suppose:
cores=$(grep "core id" /proc/cpuinfo | sort -u | wc -l)
cpus=$(grep "processor" /proc/cpuinfo | sort -u | wc -l)
[ $cpus -eq $cores ] || ht=1
BTW there is a new `nproc` utility included now with coreutils
which counts the number of processors taking into account those
brought offline on the system, or those not made available to
the process with taskset.
Also I notice http://www.codemonkey.org.uk/projects/x86info/
has recently been updated to output cpu topology info.
cheers,
Pádraig.
More information about the ILUG
mailing list