On Mon, Oct 18, 2010 at 15:39, Hernandez, Hugo (NIH/NIAID) [C]
<hugo.hernan...@nih.gov> wrote:
> Here it was my solution:
>
> # get the correct number of real CPUs (two quad-core processors)
> CPU_NUM=`cat /proc/cpuinfo  | grep cores | uniq | awk '{ print $4*2 }'`

Here's a slightly more efficient version to compute the same thing:

  CPU_NUM=`awk '/cores/{print $4 * 2; exit}' /proc/cpuinfo`

However, I'm not sure that will be accurate in all cases.

Try this instead?

  CPU_NUM=`awk '/^phys/' /proc/cpuinfo |sort -u | wc -l

Or even:
  CPU_NUM=`awk '/^phys/{CPU[$4]++} END {print length(CPU)}' /proc/cpuinfo`

-- 
Jesse Becker

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Ganglia-general mailing list
Ganglia-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to