Fix physical core calculation
authorTeemu Heikkilä <teemu@emblica.fi>
Fri, 28 Oct 2016 18:37:46 +0000 (21:37 +0300)
committerTeemu Heikkilä <teemu@emblica.fi>
Fri, 28 Oct 2016 18:37:46 +0000 (21:37 +0300)
discourse-setup

index 8026da078e4a5efcfa3be612a4b7eb0168eb14e0..45c769670f3a091e589af822d3b18c3b102b87a3 100755 (executable)
@@ -134,8 +134,8 @@ scale_ram_and_cpu() {
     avail_gb=$(check_osx_memory)
     avail_cores=`sysctl hw.ncpu | awk '/hw.ncpu:/ {print $2}'`
   else
-    avail_gb=$(check_linux_memory) 
-    avail_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $4}'`
+    avail_gb=$(check_linux_memory)
+    avail_cores=$((`awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo`*`sort /proc/cpuinfo | uniq | grep -c "physical id"`))
   fi
   echo "Found ${avail_gb}GB of memory and $avail_cores physical CPU cores"