Browse Source

Add tornado-pypy-raw.

INADA Naoki 12 years ago
parent
commit
8ca7d5424b
2 changed files with 39 additions and 0 deletions
  1. 8 0
      tornado/benchmark_config
  2. 31 0
      tornado/setup_pypy.py

+ 8 - 0
tornado/benchmark_config

@@ -13,6 +13,14 @@
       "query_url": "/db?queries=",
       "port": 8080,
       "sort": 53
+    },
+    "pypy-raw": {
+      "setup_file": "setup_pypy",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "port": 8080,
+      "sort": 134
     }
   }]
 }

+ 31 - 0
tornado/setup_pypy.py

@@ -0,0 +1,31 @@
+import subprocess
+import sys
+import setup_util
+import os
+from os.path import expanduser
+
+home = expanduser("~")
+cwd = "%s/FrameworkBenchmarks/tornado" % home
+pypy = "%s/FrameworkBenchmarks/installs/pypy-2.0.2/bin/pypy" % home
+
+
+def start(args):
+    setup_util.replace_text(
+        cwd + "/server.py", "localhost", args.database_host)
+
+    subprocess.Popen(pypy + " %s/FrameworkBenchmarks/tornado/server.py --port=8080 --logging=error" % home, shell=True, cwd=cwd)
+    return 0
+
+
+def stop():
+    p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+    out, err = p.communicate()
+    for line in out.splitlines():
+        if 'server.py' in line:
+            #try:
+            pid = int(line.split(None, 2)[1])
+            os.kill(pid, 9)
+            #except OSError:
+            #    pass
+
+    return 0