[pypy-svn] r75104 - pypy/benchmarks/own/twisted
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 4 15:13:40 CEST 2010
Author: arigo
Date: Fri Jun 4 15:13:39 2010
New Revision: 75104
Modified:
pypy/benchmarks/own/twisted/benchlib.py
Log:
A different hack: call 'netstat' and stop when
there are few TIME_WAIT connections left.
Modified: pypy/benchmarks/own/twisted/benchlib.py
==============================================================================
--- pypy/benchmarks/own/twisted/benchlib.py (original)
+++ pypy/benchmarks/own/twisted/benchlib.py Fri Jun 4 15:13:39 2010
@@ -105,9 +105,14 @@
# For tests that do a lot of TCP connexions, we sleep a bit more than
# 2 minutes at the end. This makes sure that the sockets have time to
# get out of the TIME_WAIT state before we do anything more.
- global _interface
- if _interface != 1:
- print >> sys.stderr, "sleeping 125 seconds..."
- import time
- time.sleep(125)
- _interface = 1
+ print >> sys.stderr, "sleeping up to 132 seconds...",
+ import time, os
+ for i in range(24):
+ g = os.popen('netstat -atn')
+ data = g.read()
+ g.close()
+ if ('Active Internet connections' in data and
+ data.count('TIME_WAIT') < 20):
+ break
+ time.sleep(5.5)
+ print >> sys.stderr, "done"
More information about the Pypy-commit
mailing list