summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2011-12-05 13:01:17 +0100
committerJohannes Weiner <hannes@cmpxchg.org>2011-12-05 13:01:17 +0100
commit3e33ec53900700cfb21b2c760b0358dace986595 (patch)
tree6c040137d14289fb0e76ea714b2ab0e7c76b6509
parent3df3a46a5158ddbcc77f5d1550b664bba67d94f7 (diff)
zoneinfodict: present /proc/zoneinfo as dictionary with unique keys
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rwxr-xr-xzoneinfodict19
1 files changed, 19 insertions, 0 deletions
diff --git a/zoneinfodict b/zoneinfodict
new file mode 100755
index 0000000..60ebe41
--- /dev/null
+++ b/zoneinfodict
@@ -0,0 +1,19 @@
+#!/usr/bin/python2
+
+def dump():
+ node = None
+ zone = None
+ for line in open('/proc/zoneinfo'):
+ if line.startswith('Node '):
+ # Node N, zone Z
+ parts = line.split()
+ node = int(parts[1][0:-1])
+ zone = parts[3]
+ elif line.startswith(' nr_'):
+ # nr_something N
+ parts = line.split()
+ key = parts[0]
+ val = int(parts[1])
+ print('%d_%s_%s %d' % (node, zone, key, val))
+
+dump()