add free example

This commit is contained in:
Doug MacEachern 2007-09-09 19:47:00 +00:00
parent bd22abb351
commit 379f4647b8
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import os, sigar;
sg = sigar.open()
mem = sg.mem()
swap = sg.swap()
sg.close()
print "\tTotal\tUsed\tFree"
print "Mem:\t",\
(mem.total() / 1024), \
(mem.used() / 1024), \
(mem.free() / 1024)
print "Swap:\t", \
(swap.total() / 1024), \
(swap.used() / 1024), \
(swap.free() / 1024)
print "RAM:\t", mem.ram(), "MB"