Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Sylvain Tricot | 263a7b2850 |
|
@ -36,7 +36,6 @@ def get_users_list():
|
||||||
|
|
||||||
|
|
||||||
def get_resources_percent(username=None):
|
def get_resources_percent(username=None):
|
||||||
try:
|
|
||||||
if username is None:
|
if username is None:
|
||||||
user_opt = ['-e']
|
user_opt = ['-e']
|
||||||
else:
|
else:
|
||||||
|
@ -47,8 +46,6 @@ def get_resources_percent(username=None):
|
||||||
cmd = Popen(['ps', '-o', 'pmem', '--no-headers'] + user_opt, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
|
cmd = Popen(['ps', '-o', 'pmem', '--no-headers'] + user_opt, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
|
||||||
output = map(float, cmd.stdout.read().decode('utf8').split())
|
output = map(float, cmd.stdout.read().decode('utf8').split())
|
||||||
mem_percent = sum(output)
|
mem_percent = sum(output)
|
||||||
except:
|
|
||||||
cpu_percent = mem_percent = 0
|
|
||||||
return cpu_percent, mem_percent
|
return cpu_percent, mem_percent
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue