mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: CPU detection improved for Mac OSX (Thanks to Wayne E. Seguin).
This commit is contained in:
parent
67e3d3ea77
commit
82b50467ce
10
src/parallel
10
src/parallel
|
@ -2462,7 +2462,10 @@ sub no_of_cpus_darwin {
|
|||
# Returns:
|
||||
# Number of physical CPUs on Mac Darwin
|
||||
# undef if not Mac Darwin
|
||||
my $no_of_cpus = `sysctl -a hw 2>/dev/null | grep -w physicalcpu | awk '{ print \$2 }'`;
|
||||
my $no_of_cpus =
|
||||
(`sysctl -n hw.physicalcpu`
|
||||
or
|
||||
`sysctl -a hw 2>/dev/null | grep -w physicalcpu | awk '{ print \$2 }'`);
|
||||
return $no_of_cpus;
|
||||
}
|
||||
|
||||
|
@ -2470,7 +2473,10 @@ sub no_of_cores_darwin {
|
|||
# Returns:
|
||||
# Number of CPU cores on Mac Darwin
|
||||
# undef if not Mac Darwin
|
||||
my $no_of_cores = `sysctl -a hw 2>/dev/null | grep -w logicalcpu | awk '{ print \$2 }'`;
|
||||
my $no_of_cores =
|
||||
(`sysctl -n hw.logicalcpu`
|
||||
or
|
||||
`sysctl -a hw 2>/dev/null | grep -w logicalcpu | awk '{ print \$2 }'`);
|
||||
return $no_of_cores;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue