mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 20:57:53 +00:00
Chris Howey <howeyc@gmail.com> says: Finding the number of cores does
not seem to be correct on FreeBSD (at least for me).
This commit is contained in:
parent
9a4522675c
commit
6f78fafc20
10
src/parallel
10
src/parallel
|
@ -2123,14 +2123,20 @@ sub no_of_cores_darwin {
|
|||
sub no_of_cpus_freebsd {
|
||||
# Returns:
|
||||
# Number of physical CPUs on FreeBSD
|
||||
my $no_of_cpus = `sysctl hw.ncpu 2>/dev/null | awk '{ print \$2 }'`;
|
||||
my $no_of_cpus =
|
||||
(`sysctl -a dev.cpu | grep \%parent | awk '{ print \$2 }' | uniq | wc -l | awk '{ print \$1 }'`
|
||||
or
|
||||
`sysctl hw.ncpu 2>/dev/null | awk '{ print \$2 }'`);
|
||||
return $no_of_cpus;
|
||||
}
|
||||
|
||||
sub no_of_cores_freebsd {
|
||||
# Returns:
|
||||
# Number of CPU cores on FreeBSD
|
||||
my $no_of_cores = `sysctl -a hw 2>/dev/null | grep -w logicalcpu | awk '{ print \$2 }'`;
|
||||
my $no_of_cores =
|
||||
(`sysctl hw.ncpu 2>/dev/null | awk '{ print \$2 }'`
|
||||
or
|
||||
`sysctl -a hw 2>/dev/null | grep -w logicalcpu | awk '{ print \$2 }'`);
|
||||
return $no_of_cores;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue