sigar/bindings/ruby/examples/free.rb
Doug MacEachern f58f1b1891 some examples
2007-09-03 02:01:31 +00:00

20 lines
384 B
Ruby

require 'rbsigar'
sigar = Sigar.new
mem = sigar.mem
swap = sigar.swap
puts "\tTotal\tUsed\tFree"
puts "Mem: " +
(mem.total / 1024).to_s + "\t" +
(mem.used / 1024).to_s + "\t" +
(mem.free/ 1024).to_s
puts "Swap: " +
(swap.total / 1024).to_s + "\t" +
(swap.used / 1024).to_s + "\t" +
(swap.free/ 1024).to_s
puts "RAM: " + mem.ram.to_s + "MB";