Heinz N. Gies 12 роки тому
батько
коміт
891545c2b3
3 змінених файлів з 9 додано та 9 видалено
  1. BIN
      elli/.benchmark_config.swp
  2. 5 5
      elli/setup_erlang.py
  3. 4 4
      elli/src/elli_bench_cb.erl

BIN
elli/.benchmark_config.swp


+ 5 - 5
elli/setup_erlang.py

@@ -7,11 +7,11 @@ def start(args):
 #  setup_util.replace_text("rails/config/database-ruby.yml", "host: .*", "host: " + args.database_host)
   
   try:
-    subprocess.check_call("/usr/bin/curl -klO https://elearning.erlang-solutions.com/couchdb//rbingen_adapter//package_R16B_precise64_1361901944/esl-erlang_16.b-1~ubuntu~precise_amd64.deb", shell=True, cwd="cowboy")
-    subprocess.check_call("sudo /usr/bin/dpkg --install esl-erlang_16.b-1~ubuntu~precise_amd64.deb", shell=True, cwd="cowboy")
-    subprocess.check_call("./rebar get-deps", shell=True, cwd="cowboy")
-    subprocess.check_call("./rebar compile", shell=True, cwd="cowboy")
-    subprocess.check_call("erl -pa ebin deps/*/ebin -s hello_world -noshell -detached", shell=True, cwd="cowboy")
+    subprocess.check_call("/usr/bin/curl -klO https://elearning.erlang-solutions.com/couchdb//rbingen_adapter//package_R16B_precise64_1361901944/esl-erlang_16.b-1~ubuntu~precise_amd64.deb", shell=True, cwd="elli")
+    subprocess.check_call("sudo /usr/bin/dpkg --install esl-erlang_16.b-1~ubuntu~precise_amd64.deb", shell=True, cwd="elli")
+    subprocess.check_call("./rebar get-deps", shell=True, cwd="elli")
+    subprocess.check_call("./rebar compile", shell=True, cwd="elli")
+    subprocess.check_call("erl -pa ebin deps/*/ebin -s elli_bench -noshell -detached", shell=True, cwd="elli")
     return 0
   except subprocess.CalledProcessError:
     return 1

+ 4 - 4
elli/src/elli_bench_cb.erl

@@ -17,12 +17,12 @@ handle('GET',[<<"db">>], Req) ->
         random:seed(erlang:now()),
         JSON = case elli_request:get_arg(<<"queries">>, Req) of
 		undefined ->
-			{result_packet, _, _, [Res], _} = emysql:execute(test_pool, db_stmt, [random:uniform(10000)]),
-			Res;
+			{result_packet, _, _, [[ID, Rand]], _} = emysql:execute(test_pool, db_stmt, [random:uniform(10000)]),
+			{[{<<"id">>, ID}, {<<"randomNumber">>, Rand}]};
 		N ->
 			I = list_to_integer(binary_to_list(N)),
-			Res = [ Res || 
-			        {result_packet, _, _, [Res], _} <- [emysql:execute(test_pool, db_stmt, [random:uniform(10000)]) || _ <- lists:seq(1, I) ]],
+			Res = [ {[{<<"id">>, ID}, {<<"randomNumber">>, Rand}]} || 
+			        {result_packet, _, _, [[ID, Rand]], _} <- [emysql:execute(test_pool, db_stmt, [random:uniform(10000)]) || _ <- lists:seq(1, I) ]],
 			Res
 		end,
     {ok, [{<<"Content-Type">>, <<"application/json">>}], jiffy:encode(JSON)};