Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/basho_bench.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@

-export([start/0]).

-export([setup_benchmark/1, run_benchmark/1, await_completion/1, main/1, md5/1, get_test_dir/0]).
-export([
setup_benchmark/2,
run_benchmark/1,
await_completion/1,
main/1,
md5/1,
get_test_dir/0
]).

-include("basho_bench.hrl").


Expand All @@ -34,7 +42,7 @@ start() ->
%% API
%% ====================================================================

setup_benchmark(Opts) ->
setup_benchmark(Opts, Configs) ->
BenchName = bench_name(Opts),
TestDir = test_dir(Opts, BenchName),
application:set_env(basho_bench, test_dir, TestDir),
Expand Down Expand Up @@ -62,6 +70,11 @@ setup_benchmark(Opts) ->
CustomLagerLevel = basho_bench_config:get(log_level, debug),
lager:set_loglevel(lager_console_backend, CustomLagerLevel),
lager:set_loglevel(lager_file_backend, ConsoleLog, CustomLagerLevel),

%% Make sure this happens after starting lager or failures wont
%% show.
basho_bench_config:load(Configs),

case basho_bench_config:get(distribute_work, false) of
true -> setup_distributed_work();
false -> ok
Expand All @@ -83,10 +96,6 @@ run_benchmark(Configs) ->
load_source_files(SourceDir)
end,

%% Make sure this happens after starting lager or failures wont
%% show.
basho_bench_config:load(Configs),

%% Copy the config into the test dir for posterity
[ begin {ok, _} = file:copy(Config, filename:join(TestDir, filename:basename(Config))) end
|| Config <- Configs ],
Expand Down Expand Up @@ -117,7 +126,7 @@ main(Args) ->
ok = maybe_net_node(Opts),
ok = maybe_join(Opts),
{ok, _} = start(),
setup_benchmark(Opts),
setup_benchmark(Opts, Configs),
run_benchmark(Configs),
await_completion(infinity).

Expand Down