Commits

Anonymous committed ae781af

updated thruput test.

Comments (0)

Files changed (2)

 *.pyc
 test/log*
 */yatce.app
+*.tch
+*.tcb

src/performer.erl

 -export([ run/1, r/3 ]).
 -export([ test_ets/3, test_dets/3, test_yatce/3, test_tcerl/3 ]).
 
--record(r, {k,v}).
-
 %% usage: 
 %%   > performer:start(PathToLibdir, NumThreads, DataAmount).
 %%   > 
     timer:sleep(Interval), %miliseconds
     r(Fun, NumOperation-1, Interval).
 
-
 test_ets(NumThread, NumOperation, Interval)->
     _TableName = ets:new(test_ets, [set, named_table, {write_concurrency, true}, public]),
     Coordinator = self(),
 				       Coordinator ! finished end) end, List),
     lists:map( fun(_)-> receive _-> ok end end, List ),
     {ok,closed}=TCADB:close(),
-%    erlang:display(TCADB),
     application:stop(yatce).
     
-test_tcerl(_,_,_)->    not_yet_implemented.
+% you need tcerl installed.
+test_tcerl(NumThread, NumOperation, Interval)-> 
+    ok=application:start(tcerl),
+    {ok, Tcerl} = tcbdb:open(<<"test_tcerl.tcb">>, [create,writer,reader]),
+    Coordinator = self(),
+
+    List = get_list( NumThread, nil ),
+    Fun = fun(Key, Value) -> 
+		  ok = tcbdb:put(Tcerl, Key,Value) ,
+		  tcbdb:get(Tcerl, Key) 
+	  end,
+    lists:map( fun(_)-> spawn( fun()-> r(Fun, NumOperation, Interval),
+				       Coordinator ! finished end) end, List),
+    lists:map( fun(_)-> receive _-> ok end end, List ),
+    ok=tcbdb:close(Tcerl),
+%    erlang:display(TCADB),
+    application:stop(tcerl).
 
 run(Argv)-> 
+    {A1, A2, A3}=now(),
+    random:seed(A1, A2, A3),
     [NumThread, NumOperation, _Interval] = Argv,
     io:format("processing ~p records (qps):~n", [ NumOperation * NumThread ] ),
-    Testcases = [test_ets, test_dets, test_yatce, test_tcerl],
+    Testcases = [ test_ets, test_dets, test_yatce, test_tcerl],
     run(Testcases, Argv).
 
 run([], _)-> [];
 run([Testcase|Remain], Argv)->
-    {A1, A2, A3}=now(),
-    random:seed(A1, A2, A3),
     [NumThread, NumOperation, _] = Argv,
     {Microsec, _Result} = timer:tc(?MODULE, Testcase, Argv),
     Thruput = NumOperation * NumThread * 1000000 / Microsec,
     io:format( "~p: ~p (tps)~n", [Testcase, Thruput]),
+%    timer:sleep(3000), % 3 sec interval
     [Thruput | run(Remain, Argv)]. %microseconds