Re: getting processor numbers

Paul Jackson
2007-04-04T03:04:12Z

Ulrich wrote:
> For sysconf() we still need better support. Maybe now somebody will
> step up and say they need faster sysconf as well.

That won't be me ;).

For any kernel compiled with CONFIG_CPUSETS (which includes the major
distros I am aware of), one can just count the bits in the top cpusets
'cpus' value, which is always the online CPU mask. Even if your user
level software is making no conscious use of cpusets, this works, for
kernels so configured.

If there is someone who needs both a faster sysconf
(_SC_NPROCESSORS_CONF) and a kernel without CPUSETS configured, then
they will have to speak up for themselves.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.925.600.0401