diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-02-11 17:32:54 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-02-16 10:37:18 +0000 |
commit | ace94c0df33837f47c727f4a8a8e36809bb25b88 (patch) | |
tree | 9840ab465461dfbf7c7eb98da079b86ad96edb5b | |
parent | 890efdeae239d0c44def4b25c87441300fd1bbee (diff) |
Give VirtualBox access to all host CPU cores
via https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck
-rw-r--r-- | Vagrantfile | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Vagrantfile b/Vagrantfile index 0fcf73de0..33fca39bc 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -97,7 +97,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # The bundle install fails unless you have quite a large amount of # memory; insist on 1.5GiB: config.vm.provider "virtualbox" do |vb| + host = RbConfig::CONFIG['host_os'] + # Give VM access to all cpu cores on the host + if host =~ /darwin/ + cpus = `sysctl -n hw.ncpu`.to_i + elsif host =~ /linux/ + cpus = `nproc`.to_i + else # sorry Windows folks, I can't help you + cpus = 1 + end + vb.customize ["modifyvm", :id, "--memory", ALAVETELI_MEMORY] + vb.customize ["modifyvm", :id, "--cpus", cpus] end # Fetch and run the install script: |