Created
November 6, 2009 17:45
-
-
Save boorad/228138 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% fprof:apply(M, F, A) | |
% fprof:profile() | |
% fprof:analyse() | |
-module (reads_bench). | |
-export ([doit/2]). | |
doit(Conns, Reps) -> | |
Begin = erlang:now(), | |
Self = self(), | |
[spawn(fun() -> read(Self, Reps) end) || _I <- lists:seq(1,Conns)], | |
ok = wait_result(Conns), | |
% seconds to run the test | |
timer:now_diff(erlang:now(), Begin)/1000000. | |
wait_result(0) -> | |
ok; | |
wait_result(N) -> | |
receive done -> wait_result(N-1) end. | |
read(Parent, 0) -> | |
Parent ! done; | |
read(Parent, M) -> | |
%% for showroom | |
% {ok, Db} = showroom_api:open_db(<<"test_suite_db">>, []), | |
% {ok, _} = showroom_api:open_doc(Db, <<"_local/foo">>), | |
% showroom_api:close_db(Db), | |
%% for couch | |
{ok, Db} = couch_db:open(<<"test_suite_db">>, []), | |
{ok, _} = couch_db:open_doc(Db, <<"_local/foo">>), | |
couch_db:close(Db), | |
read(Parent, M-1). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment