From 379f4647b884b5c3b943471b73cba6c7b1351265 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 9 Sep 2007 19:47:00 +0000 Subject: [PATCH] add free example --- bindings/python/examples/free.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bindings/python/examples/free.py diff --git a/bindings/python/examples/free.py b/bindings/python/examples/free.py new file mode 100644 index 00000000..c57fca88 --- /dev/null +++ b/bindings/python/examples/free.py @@ -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" +