From 6f78fafc20f7500f093a62c94adab64462e8fbbd Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 26 Jan 2011 00:49:04 +0100 Subject: [PATCH] Chris Howey says: Finding the number of cores does not seem to be correct on FreeBSD (at least for me). --- src/parallel | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/parallel b/src/parallel index 5b156ccc..99bdcd48 100755 --- a/src/parallel +++ b/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; }