Browse Source

Added benchmarking periphera

Eric Easley 12 năm trước cách đây
mục cha
commit
05086f9285
4 tập tin đã thay đổi với 48 bổ sung0 xóa
  1. 0 0
      UrWeb/__init__.py
  2. 20 0
      UrWeb/benchmark_config
  3. 27 0
      UrWeb/setup.py
  4. 1 0
      UrWeb/source_code

+ 0 - 0
UrWeb/__init__.py


+ 20 - 0
UrWeb/benchmark_config

@@ -0,0 +1,20 @@
+{
+  "framework": "Ur/Web",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Full",
+      "database": "Postgres",
+      "framework": "Ur/Web",
+      "language": "Ur",
+      "orm": "Micro",
+      "platform": "Ur/Web",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Ur/Web",
+    }
+  }]
+}

+ 27 - 0
UrWeb/setup.py

@@ -0,0 +1,27 @@
+import subprocess
+import os
+
+def start(args):
+  subprocess.check_call("urweb bench", shell=True, cwd="UrWeb")
+
+  threads = str(args.max_threads)
+  conn_string = ('dbname=hello_world '
+                'user=benchmarkdbuser '
+                'password=benchmarkdbpass '
+                'host=' + args.database_host)
+  env = {'URWEB_PQ_CON': conn_string}
+  subprocess.Popen("./bench.exe -t " + threads + " > /dev/null",
+                   env=env, shell=True, cwd="UrWeb")
+  return 0
+
+def stop():
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'bench.exe' in line:
+      try:
+        pid = int(line.split(None, 2)[1])
+        os.kill(pid, 9)
+      except OSError:
+        pass
+  return 0

+ 1 - 0
UrWeb/source_code

@@ -0,0 +1 @@
+./UrWeb/bench.ur