from C:

#include <unistd.h>

int main(void)
{
    printf("%ld CPUs online\n", sysconf(_SC_NPROCESSORS_ONLN));
    return 0;
}

from shell:

$ getconf _NPROCESSORS_ONLN

Cheers,

Matt

On Mon, Sep 04, 2000 at 09:08:25AM +0100, Mikael Aronsson wrote:
> Hi !
> 
> What is the best way to detect the number of CPU's ?, I guess I could look in 
>/proc/cpuinfo, but is there a better more portable way to do it ?
> 
> Mikael
> 



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to