summaryrefslogtreecommitdiff
path: root/client-responsiveness/scripts/get_client_stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'client-responsiveness/scripts/get_client_stats.py')
-rwxr-xr-xclient-responsiveness/scripts/get_client_stats.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/client-responsiveness/scripts/get_client_stats.py b/client-responsiveness/scripts/get_client_stats.py
new file mode 100755
index 0000000..59f9aa6
--- /dev/null
+++ b/client-responsiveness/scripts/get_client_stats.py
@@ -0,0 +1,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