'Show list.'

def func(self):

    global _IDMAPPER
    if (not _IDMAPPER):
        from evennia.utils.idmapper import models as _IDMAPPER
    if ('flushmem' in self.switches):
        (prev, _) = _IDMAPPER.cache_size()
        nflushed = _IDMAPPER.flush_cache()
        (now, _) = _IDMAPPER.cache_size()
        string = 'The    Idmapper    cache    freed    |w{idmapper}|n    database    objects.\nThe    Python    garbage    collector    freed    |w{gc}|n    Python    instances    total.'
        self.caller.msg(string.format(idmapper=(prev - now), gc=nflushed))
        return
    os_windows = (os.name == 'nt')
    pid = os.getpid()
    if os_windows:
        try:
            import psutil
            has_psutil = True
        except ImportError:
            has_psutil = False
        if has_psutil:
            loadavg = psutil.cpu_percent()
            _mem = psutil.virtual_memory()
            rmem = (_mem.used / (1000.0 * 1000))
            pmem = _mem.percent
            if ('mem' in self.switches):
                string = 'Total    computer    memory    usage:    |w%g|n    MB    (%g%%)'
                self.caller.msg((string % (rmem, pmem)))
                return
            loadtable = EvTable('property', 'statistic', align='l')
            loadtable.add_row('Total    CPU    load', ('%g    %%' % loadavg))
            loadtable.add_row('Total    computer    memory    usage', ('%g    MB    (%g%%)' % (rmem, pmem)))
            (loadtable.add_row('Process    ID', ('%g' % pid)),)
        else:
            loadtable = "Not    available    on    Windows    without    'psutil'    library    (install    with    |wpip    install    psutil|n)."
    else:
        global _RESOURCE
        if (not _RESOURCE):
            import resource as _RESOURCE
        loadavg = os.getloadavg()[0]
        rmem = (float(os.popen(('ps    -p    %d    -o    %s    |    tail    -1' % (pid, 'rss'))).read()) / 1000.0)
        vmem = (float(os.popen(('ps    -p    %d    -o    %s    |    tail    -1' % (pid, 'vsz'))).read()) / 1000.0)
        pmem = float(os.popen(('ps    -p    %d    -o    %s    |    tail    -1' % (pid, '%mem'))).read())
        rusage = _RESOURCE.getrusage(_RESOURCE.RUSAGE_SELF)
        if ('mem' in self.switches):
            string = 'Memory    usage:    RMEM:    |w%g|n    MB    (%g%%),    VMEM    (res+swap+cache):    |w%g|n    MB.'
            self.caller.msg((string % (rmem, pmem, vmem)))
            return
        loadtable = EvTable('property', 'statistic', align='l')
        loadtable.add_row('Server    load    (1    min)', ('%g' % loadavg))
        (loadtable.add_row('Process    ID', ('%g' % pid)),)
        loadtable.add_row('Memory    usage', ('%g    MB    (%g%%)' % (rmem, pmem)))
        loadtable.add_row('Virtual    address    space', '')
        loadtable.add_row('|x(resident+swap+caching)|n', ('%g    MB' % vmem))
        loadtable.add_row('CPU    time    used    (total)', ('%s    (%gs)' % (utils.time_format(rusage.ru_utime), rusage.ru_utime)))
        loadtable.add_row('CPU    time    used    (user)', ('%s    (%gs)' % (utils.time_format(rusage.ru_stime), rusage.ru_stime)))
        loadtable.add_row('Page    faults', ('%g    hard,        %g    soft,    %g    swapouts' % (rusage.ru_majflt, rusage.ru_minflt, rusage.ru_nswap)))
        loadtable.add_row('Disk    I/O', ('%g    reads,    %g    writes' % (rusage.ru_inblock, rusage.ru_oublock)))
        loadtable.add_row('Network    I/O', ('%g    in,    %g    out' % (rusage.ru_msgrcv, rusage.ru_msgsnd)))
        loadtable.add_row('Context    switching', ('%g    vol,    %g    forced,    %g    signals' % (rusage.ru_nvcsw, rusage.ru_nivcsw, rusage.ru_nsignals)))
    string = ('|wServer    CPU    and    Memory    load:|n\n%s' % loadtable)
    (total_num, cachedict) = _IDMAPPER.cache_size()
    sorted_cache = sorted([(key, num) for (key, num) in cachedict.items() if (num > 0)], key=(lambda tup: tup[1]), reverse=True)
    memtable = EvTable('entity    name', 'number', 'idmapper    %', align='l')
    for tup in sorted_cache:
        memtable.add_row(tup[0], ('%i' % tup[1]), ('%.2f' % ((float(tup[1]) / total_num) * 100)))
    string += ('\n|w    Entity    idmapper    cache:|n    %i    items\n%s' % (total_num, memtable))
    self.caller.msg(string)
