[Orca-users] Solaris & Linux: number cpus

Blair Zajac blair at orcaware.com
Sun Jun 15 11:08:40 PDT 2003


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/



More information about the Orca-users mailing list