[Orca-users] Solaris & Linux: number cpus

Jason.Santos at pinnaclewest.com Jason.Santos at pinnaclewest.com
Mon Jun 16 09:12:18 PDT 2003


And don't forget about Intel processors with HyperThreading which show
up as 2 CPUs even though there's really only one...



-----Original Message-----
From: Blair Zajac [mailto:blair at orcaware.com] 
Sent: Sunday, June 15, 2003 11:09 AM
To: Orca Users Mailing List
Subject: [Orca-users] Solaris & Linux: number cpus


Procallator currently has a measurement called ncpus, which is measured
by counting the number of lines that match /^cpu[0-9]*/ in /proc/stat.
On my single CPU system I get

% cat /proc/stat
cpu  7854776 3300966 962066 91960316
cpu0 7854776 3300966 962066 91960316
....

So on a single CPU machine, internally, procallator records 2 for ncpus
but prints ncpu-1 to the output data file.  This isn't ideal, but I'm
going to ignore this for now and review the code later.

On Solaris, orcallator.se doesn't record ncpus and I'd like it to.
However, on Solaris, you can get the number of CPUs configured and the
number CPUs online, as seen in SE's examples/infotool.se:

  fprintf(output, "CPUs Configured                       : %d\n",
          sysconf(_SC_NPROCESSORS_CONF));
  fprintf(output, "CPUs Online                           : %d\n",
          sysconf(_SC_NPROCESSORS_ONLN));

I want to match ncpus on both OSes to be consistent.

So the my question is, on Linux, can you disable using a CPU when you
have a SMP kernel running?  Will /proc/stat still show a disabled or
offline CPU?  What will /proc/stat show on a dual machine running a
non-SMP kernel?

We may need two measurements, ncpus and ncpus_avail or something like
that.

Best,
Blair

-- 
Blair Zajac <blair at orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/
_______________________________________________
Orca-users mailing list
Orca-users at orcaware.com
http://www.orcaware.com/mailman/listinfo/orca-users






More information about the Orca-users mailing list