Added the ability for Windows users to use a (very limited version of the service command. Resolves #570.
This commit is contained in:
parent
5191ace2a1
commit
686bc92888
1 changed files with 5 additions and 5 deletions
|
|
@ -670,7 +670,9 @@ class CmdServerLoad(MuxCommand):
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
|
|
||||||
if os_windows:
|
if os_windows:
|
||||||
# Windows requires the psutil module to get statistics like this
|
# Windows requires the psutil module to even get paltry
|
||||||
|
# statistics like this (it's pretty much worthless,
|
||||||
|
# unfortunately, since it's not specific to the process) /rant
|
||||||
try:
|
try:
|
||||||
import psutil
|
import psutil
|
||||||
has_psutil = True
|
has_psutil = True
|
||||||
|
|
@ -681,12 +683,10 @@ class CmdServerLoad(MuxCommand):
|
||||||
loadavg = psutil.cpu_percent()
|
loadavg = psutil.cpu_percent()
|
||||||
_mem = psutil.virtual_memory()
|
_mem = psutil.virtual_memory()
|
||||||
rmem = _mem.used / (1000 * 1000)
|
rmem = _mem.used / (1000 * 1000)
|
||||||
vmem = "N/A on Windows"
|
|
||||||
pmem = _mem.percent
|
pmem = _mem.percent
|
||||||
rusage = "N/A on Windows"
|
|
||||||
|
|
||||||
if "mem" in self.switches:
|
if "mem" in self.switches:
|
||||||
string = "Memory usage: {w%g{n MB (%g%%)"
|
string = "Total computer memory usage: {w%g{n MB (%g%%)"
|
||||||
self.caller.msg(string % (rmem, pmem))
|
self.caller.msg(string % (rmem, pmem))
|
||||||
return
|
return
|
||||||
# Display table
|
# Display table
|
||||||
|
|
@ -699,7 +699,7 @@ class CmdServerLoad(MuxCommand):
|
||||||
"(install with {wpip install psutil{n)."
|
"(install with {wpip install psutil{n)."
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Linux / BSD (OSX)
|
# Linux / BSD (OSX) - proper pid-based statistics
|
||||||
|
|
||||||
global _RESOURCE
|
global _RESOURCE
|
||||||
if not _RESOURCE:
|
if not _RESOURCE:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue