Exemplo n.º 1
0
def get_memstats_str():
    return '\n'.join([
        ('[psutil] total     = %s' % util_str.byte_str2(total_memory())),
        ('[psutil] available = %s' % util_str.byte_str2(available_memory())),
        ('[psutil] used      = %s' % util_str.byte_str2(used_memory())),
        ('[psutil] current   = %s' % util_str.byte_str2(current_memory_usage())),
    ])
Exemplo n.º 2
0
def get_memstats_str():
    return '\n'.join([
        ('[psutil] total     = %s' % util_str.byte_str2(total_memory())),
        ('[psutil] available = %s' % util_str.byte_str2(available_memory())),
        ('[psutil] used      = %s' % util_str.byte_str2(used_memory())),
        ('[psutil] current   = %s' %
         util_str.byte_str2(current_memory_usage())),
    ])
Exemplo n.º 3
0
def get_resource_usage_str():
    usage_str_list = [
        ('+______________________'),
        ('|    RESOURCE_USAGE    process.get_memory_info()[0] / float(2 ** 20) '),
        ('|  * current_memory = %s' % util_str.byte_str2(current_memory_usage())),
    ]
    try:
        usage_str_list.extend([
            ('|  * peak_memory    = %s' % util_str.byte_str2(peak_memory())),
            ('|  * user_time      = %s' % time_str2(time_in_usermode())),
            ('|  * system_time    = %s' % time_str2(time_in_systemmode())),
        ])
    except Exception:
        pass
    usage_str_list.append('L______________________')
    usage_str = '\n'.join(usage_str_list)
    return usage_str
Exemplo n.º 4
0
def get_resource_usage_str():
    usage_str_list = [
        ('+______________________'),
        ('|    RESOURCE_USAGE    process.get_memory_info()[0] / float(2 ** 20) '
         ),
        ('|  * current_memory = %s' %
         util_str.byte_str2(current_memory_usage())),
    ]
    try:
        usage_str_list.extend([
            ('|  * peak_memory    = %s' % util_str.byte_str2(peak_memory())),
            ('|  * user_time      = %s' % time_str2(time_in_usermode())),
            ('|  * system_time    = %s' % time_str2(time_in_systemmode())),
        ])
    except Exception:
        pass
    usage_str_list.append('L______________________')
    usage_str = '\n'.join(usage_str_list)
    return usage_str
Exemplo n.º 5
0
 def rlimval_str(rlim_val):
     soft, hard = rlim_val
     softstr = util_str.byte_str2(soft) if soft != -1 else 'None'
     hardstr = util_str.byte_str2(hard) if hard != -1 else 'None'
     return '%12s, %12s' % (softstr, hardstr)
Exemplo n.º 6
0
 def rlimval_str(rlim_val):
     soft, hard = rlim_val
     softstr = util_str.byte_str2(soft) if soft != -1 else 'None'
     hardstr = util_str.byte_str2(hard) if hard != -1 else 'None'
     return '%12s, %12s' % (softstr, hardstr)
Exemplo n.º 7
0
def get_file_nBytes_str(fpath):
    from utool import util_str
    return util_str.byte_str2(os.path.getsize(fpath))
Exemplo n.º 8
0
def get_file_nBytes_str(fpath):
    from utool import util_str
    return util_str.byte_str2(os.path.getsize(fpath))
Exemplo n.º 9
0
 def rlimval_str(rlim_val):
     soft, hard = rlim_val
     softstr = util_str.byte_str2(soft) if soft != -1 else "None"
     hardstr = util_str.byte_str2(hard) if hard != -1 else "None"
     return "%12s, %12s" % (softstr, hardstr)