sigar/bindings/python/examples/free.py

22 lines
342 B
Python
Raw Normal View History

2007-09-10 03:47:00 +08:00
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"