summaryrefslogtreecommitdiff
path: root/zoneinfodict
blob: 60ebe4110a4083bd69a210f3ef262e1e23bb64a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()