blob: 59f9aa630d93011311dc28561c575e269772029c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/env python
"""
Get stats from dummy server running Soledad Client and spit them out.
"""
import commands
import urllib
import psutil
stats = urllib.urlopen('http://localhost:8080/stats').read().split()
pid, sync_phase, sync_exchange_phase = stats
res = commands.getoutput("ps -p " + pid + " -o \%cpu,\%mem")
splitted = res.split()
cpu = splitted[2]
mem = splitted[3]
print cpu, mem, sync_phase, sync_exchange_phase
|