summaryrefslogtreecommitdiff
path: root/test/mem3_cache_bench.erl
blob: a78f029d00cfe7723e22076c329402b380ef7af4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-module (mem3_cache_bench).

-export ([doit/1]).

-include("../include/config.hrl").


init() ->
    Config = #config{n=3,r=2,w=2,q=3,directory="/srv/db",
                     storage_mod="dynomite_couch_storage"},
    {ok, _Pid} = mem3:start_link([{test,true}, {config, Config}]),
    mem3:join(first, [{1, a, []}, {2, b, []}]).


doit(Reps) ->
    init(),
    Begin = erlang:now(),
    process(Reps),
    % seconds to run the test
    Time = timer:now_diff(erlang:now(), Begin)/1000000,
    mem3:stop(),
    Time.


process(0) ->
    ok;
process(M) ->
    mem3:fullmap(),
    process(M-1).