summaryrefslogtreecommitdiff
path: root/sandbox/stress.py
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2006-01-10 16:13:37 +0000
committerFederico Di Gregorio <fog@initd.org>2006-01-10 16:13:37 +0000
commit5871596eda7875e3a0cadb4db6fceb4c2995f3c5 (patch)
tree737b69d669e5b493eaa7b80d2e3eee08b1fd9f23 /sandbox/stress.py
parent1aed51693866f7e16afdfab1f9c1baefae30a9ef (diff)
downloadpsycopg2-5871596eda7875e3a0cadb4db6fceb4c2995f3c5.tar.gz
Some more tests in sandbox.
Diffstat (limited to 'sandbox/stress.py')
-rw-r--r--sandbox/stress.py28
1 files changed, 10 insertions, 18 deletions
diff --git a/sandbox/stress.py b/sandbox/stress.py
index bb31800..48e0a59 100644
--- a/sandbox/stress.py
+++ b/sandbox/stress.py
@@ -1,19 +1,11 @@
-import psycopg
-import psycopg.extras
+import psycopg2
+import threading, os, time, gc
-conn = psycopg.connect('dbname=test')
-#curs = conn.cursor()
-#curs.execute("CREATE TABLE itest (n int4)")
-
-#for i in xrange(10000000):
-# curs = conn.cursor()
-# curs.execute("INSERT INTO itest VALUES (1)")
-# curs.execute("SELECT '2003-12-12 10:00:00'::timestamp AS foo")
-# curs.execute("SELECT 'xxx' AS foo")
-# curs.fetchall()
-# curs.close()
-
-curs = conn.cursor(factory=psycopg.extras.DictCursor)
-curs.execute("select 1 as foo")
-x = curs.fetchone()
-print x['foo']
+for i in range(20000):
+ conn = psycopg2.connect('dbname=test')
+ del conn
+ if i%200 == 0:
+ datafile = os.popen('ps -p %s -o rss' % os.getpid())
+ line = datafile.readlines(2)[1].strip()
+ datafile.close()
+ print str(i) + '\t' + line