Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)

        def mem_stats():
    with open('/proc/meminfo') as f:
        for line in f:
            if line.startswith('MemTotal:'):
                mem_total = int(line.split()[1]) * 1024
            elif line.startswith('Active: '):
                mem_active = int(line.split()[1]) * 1024
            elif line.startswith('MemFree:'):
                mem_free = (int(line.split()[1]) * 1024)
            elif line.startswith('Cached:'):
                mem_cached = (int(line.split()[1]) * 1024)
            elif line.startswith('SwapTotal: '):
                swap_total = (int(line.split()[1]) * 1024)
            elif line.startswith('SwapFree: '):
                swap_free = (int(line.split()[1]) * 1024)
    return (mem_active, mem_total, mem_cached, mem_free, swap_total, swap_free)
        


src/l/i/linux-metrics-0.1.4/example.py   linux-metrics(Download)
 
    # memory
    used, total, _, _, _, _ = lm.mem_stat.mem_stats()
    print 'mem used: %s' % used
    print 'mem total: %s' % total

src/l/i/linux-metrics-HEAD/example.py   linux-metrics(Download)
 
    # memory
    used, total, _, _, _, _ = lm.mem_stat.mem_stats()
    print 'mem used: %s' % used
    print 'mem total: %s' % total

src/p/y/PyRedstone-0.2.0/pyredstone/pyredstone.py   PyRedstone(Download)
        #stats_dict['disk_reads'] = r
        #stats_dict['disk_writes'] = w
        used, total = lm.mem_stat.mem_stats()
        # In Megabytes
        stats_dict['mem_used'] = used / 1048576