Re: Question on /proc/cpuinfo

From: Jan Engelhardt
Date: Sun Sep 23 2012 - 07:52:45 EST



On Friday 2012-09-14 14:30, Cong Wang wrote:
> On 09/14/2012 07:18 AM, JA MagallÃn wrote:
>> Hi...
>>
>> Probably it is a stupid question, but... I wan to count the number of
>> processors, cores and threads on a linux system. I do it by reading
>> /proc/cpuinfo.
>
> Probably lscpu(1) is better for you, on my laptop it outputs:

Programmatically (for scripts), you want to count the number
of /sys/devices/system/cpu/cpu[0-9]*. Grepping around output
meant for humans (cpuinfo, lscpu) is always a bad idea.
--
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/