Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- host = RbConfig::CONFIG['host_os']
- # Give VM 1/4 system memory & access to all cpu cores on the host
- if host =~ /darwin/
- cpus = `sysctl -n hw.ncpu`.to_i
- # sysctl returns Bytes and we need to convert to MB
- mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
- elsif host =~ /linux/
- cpus = `nproc`.to_i
- # meminfo shows KB and we need to convert to MB
- mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement