[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.01.1209231351220.9625@nerf07.vanv.qr>
Date: Sun, 23 Sep 2012 13:52:51 +0200 (CEST)
From: Jan Engelhardt <jengelh@...i.de>
To: Cong Wang <xiyou.wangcong@...il.com>
cc: JA Magallón <jamagallonn@...il.com>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: Question on /proc/cpuinfo
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists