def memfree():
    ''' Returns kilobytes memory [total, free, buff, cached, stotal, sfree].
        useful stats are:
            free memory = free + buff + cached
            swap used = stotal - sfree
    '''
    f = open('/proc/meminfo', 'r')
    lines = f.readlines()
    f.close()
    kbs = {}
    for k in MEMKEYS:
        kbs[k] = 0
    for l in lines:
        if l[:9] == "MemTotal:":
            kbs['total'] = int(l.split()[1])
        elif l[:8] == "MemFree:":
            kbs['free'] = int(l.split()[1])
        elif l[:8] == "Buffers:":
            kbs['buff'] = int(l.split()[1])
        elif l[:8] == "Cached:":
            kbs['cache'] = int(l.split()[1])
        elif l[:10] == "SwapTotal:":
            kbs['stotal'] = int(l.split()[1])
        elif l[:9] == "SwapFree:":
            kbs['sfree'] = int(l.split()[1])
            break
    return kbs

# node list (count from 1)
dataset/ETHPy150Open coreemu/core/daemon/examples/netns/howmanynodes.py/memfree/original