tweaks to .sys
This commit is contained in:
parent
9398190a5d
commit
0849e3f09b
1 changed files with 5 additions and 3 deletions
|
@ -4,6 +4,7 @@ import platform
|
|||
from util import hook
|
||||
|
||||
|
||||
@hook.command("memory", autohelp=False)
|
||||
@hook.command(autohelp=False)
|
||||
def mem(inp):
|
||||
".mem -- Display the bot's current memory usage."
|
||||
|
@ -12,7 +13,7 @@ def mem(inp):
|
|||
status_file = open("/proc/%d/status" % os.getpid()).read()
|
||||
line_pairs = re.findall(r"^(\w+):\s*(.*)\s*$", status_file, re.M)
|
||||
status = dict(line_pairs)
|
||||
keys = 'VmSize VmLib VmData VmExe VmRSS VmStk'.split()
|
||||
keys = 'VmSize VmRSS VmStk'.split()
|
||||
return '\x02, '.join(key + ': \x02' + status[key] for key in keys)
|
||||
|
||||
elif os.name == 'nt':
|
||||
|
@ -23,10 +24,11 @@ def mem(inp):
|
|||
for amount in re.findall(r'([,0-9]+) K', out):
|
||||
total += int(amount.replace(',', ''))
|
||||
|
||||
return 'Memory usage: \x02%d kB\x02' % total
|
||||
return '\x02Memory Usage: %s kB\x02' % total
|
||||
|
||||
return mem.__doc__
|
||||
|
||||
@hook.command("system", autohelp=False)
|
||||
@hook.command(autohelp=False)
|
||||
def sys(inp):
|
||||
".sys -- Retrieves information about the host system."
|
||||
|
|
Reference in a new issue