parallel: NetBSD CPU detection.

This commit is contained in:
Ole Tange 2013-02-07 11:10:20 +01:00
parent f5d2b95970
commit 7cf332ecc0

View file

@ -2891,6 +2891,8 @@ sub no_of_cpus {
$no_of_cpus = no_of_cpus_gnu_linux() || no_of_cores_gnu_linux(); $no_of_cpus = no_of_cpus_gnu_linux() || no_of_cores_gnu_linux();
} elsif ($^O eq 'freebsd') { } elsif ($^O eq 'freebsd') {
$no_of_cpus = no_of_cpus_freebsd(); $no_of_cpus = no_of_cpus_freebsd();
} elsif ($^O eq 'netbsd') {
$no_of_cpus = no_of_cpus_netbsd();
} elsif ($^O eq 'solaris') { } elsif ($^O eq 'solaris') {
$no_of_cpus = no_of_cpus_solaris(); $no_of_cpus = no_of_cpus_solaris();
} elsif ($^O eq 'aix') { } elsif ($^O eq 'aix') {
@ -2899,6 +2901,7 @@ sub no_of_cpus {
$no_of_cpus = no_of_cpus_darwin(); $no_of_cpus = no_of_cpus_darwin();
} else { } else {
$no_of_cpus = (no_of_cpus_freebsd() $no_of_cpus = (no_of_cpus_freebsd()
|| no_of_cpus_netbsd()
|| no_of_cpus_darwin() || no_of_cpus_darwin()
|| no_of_cpus_solaris() || no_of_cpus_solaris()
|| no_of_cpus_aix() || no_of_cpus_aix()
@ -2923,6 +2926,8 @@ sub no_of_cores {
$no_of_cores = no_of_cores_gnu_linux(); $no_of_cores = no_of_cores_gnu_linux();
} elsif ($^O eq 'freebsd') { } elsif ($^O eq 'freebsd') {
$no_of_cores = no_of_cores_freebsd(); $no_of_cores = no_of_cores_freebsd();
} elsif ($^O eq 'netbsd') {
$no_of_cores = no_of_cores_netbsd();
} elsif ($^O eq 'openbsd') { } elsif ($^O eq 'openbsd') {
$no_of_cores = no_of_cores_openbsd(); $no_of_cores = no_of_cores_openbsd();
} elsif ($^O eq 'solaris') { } elsif ($^O eq 'solaris') {
@ -2933,6 +2938,7 @@ sub no_of_cores {
$no_of_cores = no_of_cores_darwin(); $no_of_cores = no_of_cores_darwin();
} else { } else {
$no_of_cores = (no_of_cores_freebsd() $no_of_cores = (no_of_cores_freebsd()
|| no_of_cores_netbsd()
|| no_of_cores_openbsd() || no_of_cores_openbsd()
|| no_of_cores_darwin() || no_of_cores_darwin()
|| no_of_cores_solaris() || no_of_cores_solaris()
@ -3033,6 +3039,24 @@ sub no_of_cores_freebsd {
return $no_of_cores; return $no_of_cores;
} }
sub no_of_cpus_netbsd {
# Returns:
# Number of physical CPUs on NetBSD
# undef if not NetBSD
my $no_of_cpus = `sysctl -n hw.ncpu`;
chomp $no_of_cpus;
return $no_of_cpus;
}
sub no_of_cores_netbsd {
# Returns:
# Number of CPU cores on NetBSD
# undef if not NetBSD
my $no_of_cores = `sysctl -n hw.ncpu`;
chomp $no_of_cores;
return $no_of_cores;
}
sub no_of_cores_openbsd { sub no_of_cores_openbsd {
# Returns: # Returns:
# Number of CPU cores on OpenBSD # Number of CPU cores on OpenBSD