sigar/bindings/ruby/examples/free.rb

20 lines
382 B
Ruby
Raw Normal View History

2010-01-18 10:26:31 +08:00
require 'sigar'
2007-09-03 10:01:31 +08:00
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";