Fixed and cleaned up the server flush output a little. Also removed a check for pypy since getmemsize is no longer used.
This commit is contained in:
parent
609c784b14
commit
b0f51b02a6
1 changed files with 13 additions and 15 deletions
|
|
@ -662,10 +662,12 @@ class CmdServerLoad(MuxCommand):
|
||||||
|
|
||||||
if "flushmem" in self.switches:
|
if "flushmem" in self.switches:
|
||||||
# flush the cache
|
# flush the cache
|
||||||
|
prev, _ = _IDMAPPER.cache_size()
|
||||||
nflushed = _IDMAPPER.flush_cache()
|
nflushed = _IDMAPPER.flush_cache()
|
||||||
string = "Flushed object idmapper cache. Python garbage " \
|
now, _ = _IDMAPPER.cache_size()
|
||||||
"collector recovered memory from %i objects."
|
string = "The Idmapper cache freed |w{idmapper}|n database objects.\n" \
|
||||||
self.caller(string % nflushed)
|
"The Python garbage collector freed |w{gc}|n Python instances total."
|
||||||
|
self.caller.msg(string.format(idmapper=(prev-now), gc=nflushed))
|
||||||
return
|
return
|
||||||
|
|
||||||
# display active processes
|
# display active processes
|
||||||
|
|
@ -739,11 +741,7 @@ class CmdServerLoad(MuxCommand):
|
||||||
|
|
||||||
string = "{wServer CPU and Memory load:{n\n%s" % loadtable
|
string = "{wServer CPU and Memory load:{n\n%s" % loadtable
|
||||||
|
|
||||||
if not is_pypy:
|
# object cache count (note that sys.getsiseof is not called so this works for pypy too.
|
||||||
# Cache size measurements are not available on PyPy
|
|
||||||
# because it lacks sys.getsizeof
|
|
||||||
|
|
||||||
# object cache size
|
|
||||||
total_num, cachedict = _IDMAPPER.cache_size()
|
total_num, cachedict = _IDMAPPER.cache_size()
|
||||||
sorted_cache = sorted([(key, num) for key, num in cachedict.items() if num > 0],
|
sorted_cache = sorted([(key, num) for key, num in cachedict.items() if num > 0],
|
||||||
key=lambda tup: tup[1], reverse=True)
|
key=lambda tup: tup[1], reverse=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue