summaryrefslogtreecommitdiffstats
path: root/perf2.py
diff options
context:
space:
mode:
Diffstat (limited to 'perf2.py')
-rw-r--r--perf2.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/perf2.py b/perf2.py
new file mode 100644
index 0000000..9d65697
--- /dev/null
+++ b/perf2.py
@@ -0,0 +1,25 @@
+# perf1.py
+# TIme of short running request
+
+from socket import *
+import time
+from threading import Thread
+
+sock = socket(AF_INET, SOCK_STREAM)
+sock.connect(('localhost', 25000))
+
+n = 0
+
+def monitor():
+ global n
+ while True:
+ time.sleep(1)
+ print(n, 'reqs/sec')
+ n = 0
+
+Thread(target=monitor).start()
+
+while True:
+ sock.send(b'1')
+ resp = sock.recv(100)
+ n += 1