From f204a0ff01e0b24505383621b39a12aece7434bf Mon Sep 17 00:00:00 2001 From: Nikolai Prokoschenko Date: Tue, 9 Jun 2015 15:41:21 +0200 Subject: [PATCH] Actually ignore hyperthreading `uniq` only works with sorted input, i.e. we need to sort, before we filter out duplicate CPU IDs --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index aedd29b42c9..b6a03dc7c6c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -89,7 +89,7 @@ elsif host =~ /linux/ #This should work on most processors, however it will fail on ones without the core id field. #So far i have only seen this on a raspberry pi. which you probably don't want to run vagrant on anyhow... #But just in case we'll default to the result of nproc if we get 0 just to be safe. - $vm_cpus = `cat /proc/cpuinfo | grep 'core id' | uniq | wc -l`.to_i + $vm_cpus = `cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l`.to_i if $vm_cpus < 1 $vm_cpus = `nproc`.to_i end