summaryrefslogtreecommitdiff
path: root/get_client_cpu_mem.py
blob: ba5049ad255cd59778ed965549876a60e7284a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
import commands
import urllib
import psutil

pid = urllib.urlopen('http://localhost:8080/pid').read()
res = commands.getoutput("ps -p " + pid + " -o \%cpu,\%mem")
splitted = res.split()
cpu = splitted[2]
mem = splitted[3]

print cpu, mem