Permalink
Browse files

add memory graphing, improve some of the benchmarks

  • Loading branch information...
1 parent 9a795aa commit 88471b6642ab07541446fa982dc324d025dd2728 @Vagabond committed Mar 18, 2013
Showing with 44 additions and 18 deletions.
  1. +7 −1 bin/bench
  2. +1 −0 rebar.config
  3. +19 −3 run.sh
  4. +17 −14 src/logbench.erl
View
@@ -8,6 +8,7 @@ main([Bench, Fmt, Iterations, Workers]) ->
setup_paths(),
code:load_file(logbench),
code:load_file(logfmt),
+ code:load_file(memgraph),
try {list_to_existing_atom(Bench), list_to_existing_atom(Fmt)} of
{BenchMark, Format} ->
case erlang:function_exported(logbench, BenchMark, 1) of
@@ -38,6 +39,8 @@ run(Bench, Format, Iterations, WC) ->
{Setup, Fun, Stop} = logbench:Bench(logfmt:Format()),
ok = filelib:ensure_dir("logs/phony.log"),
RunsPerWorker = Runs div WorkerCount,
+ {_Date, {Hour, Minute, _Second}} = calendar:local_time(),
+ memgraph:start(atom_to_list(Bench)++"_"++atom_to_list(Format)),
Setup(),
io:format("running ~p ~p with ~p iterations and ~p workers~n", [Bench, Format, Runs, WorkerCount]),
{Time, _} = timer:tc(fun() ->
@@ -50,6 +53,7 @@ run(Bench, Format, Iterations, WC) ->
OutFile = lists:flatten(["results/", atom_to_list(Bench), "_", atom_to_list(Format)]),
ok = filelib:ensure_dir(OutFile),
ok = file:write_file(OutFile, [integer_to_list(trunc(Runs/Seconds)), $\n], [append]),
+ memgraph:graph(integer_to_list(Hour) ++":"++ integer_to_list(Minute), atom_to_list(Bench)++"_"++atom_to_list(Format)),
halt(0)
catch
_:_ ->
@@ -76,8 +80,10 @@ usage() ->
halt(1).
setup_paths() ->
- true = code:add_pathz(filename:dirname(escript:script_name())
+ true = code:add_patha(filename:dirname(escript:script_name())
++ "/../ebin"),
+ true = code:add_patha(filename:dirname(escript:script_name())
+ ++ "/../deps/errd/ebin"),
ok.
View
@@ -3,6 +3,7 @@
{cover_enabled, true}.
{deps, [
+ {errd, ".*", {git, "git://github.com/archaelus/errd.git", {branch, "master"}}},
{lager, "2.0.*", {git, "git://github.com/basho/lager", {branch, "master"}}},
{log4erl, "0.9.*", {git, "git://github.com/ahmednawras/log4erl.git", {branch, "master"}}},
{alog, "1", {git, "git://github.com/siberian-fast-food/alogger.git", {branch, "master"}}},
View
22 run.sh
@@ -1,10 +1,26 @@
#!/bin/sh
-#for BENCH in el_console sync_el_console lager_console log4erl_console alog_console el_file sync_el_file lager_file log4erl_file; do
-for BENCH in el_file sync_el_file lager_file log4erl_file elog_file elogger_file fast_log_file; do
+for BENCH in el_file sync_el_file lager_file log4erl_file elog_file elogger_file fast_log_file alog_file; do
for FMT in simple small large; do
for I in 1 2 3; do
- ./bin/bench $BENCH $FMT 10000
+ ./bin/bench $BENCH $FMT 10000 1
done
done
done
+
+mv results results.1
+mkdir mem_results.1
+mv *.rrd *.png mem_results.1
+
+for BENCH in el_file sync_el_file lager_file log4erl_file elog_file elogger_file fast_log_file alog_file; do
+ for FMT in simple small large; do
+ for I in 1 2 3; do
+ ./bin/bench $BENCH $FMT 10000 10
+ done
+ done
+done
+
+mv results results.100
+mkdir mem_results.100
+mv *.rrd *.png mem_results.100
+
View
@@ -51,6 +51,8 @@ alog_console({Fmt, Args}) ->
true = code:add_pathz(filename:dirname(escript:script_name())
++ "/../deps/alog/ebin"),
application:start(sasl),
+ application:load(alog),
+ application:set_env(alog, install_error_logger_handler, false),
application:start(alog),
ok = alog_control:delete_all_flows(),
ok = alog_control:add_new_flow({mod,['_']}, {'=<', debug}, [alog_tty])
@@ -117,6 +119,7 @@ alog_file({Fmt, Args}) ->
application:start(sasl),
application:load(alog),
application:set_env(alog, enabled_loggers, [alog_disk_log]),
+ application:set_env(alog, install_error_logger_handler, false),
application:set_env(alog, alog_disk_log, [{name, alog_disk_log},
{file, "logs/alogger.log"},
{format, external}]),
@@ -127,8 +130,12 @@ alog_file({Fmt, Args}) ->
fun() ->
alog:error(Fmt, Args)
end,
- %% this seems a little flaky, but better than nothing
- fun() -> _ = sys:get_status(alog_disk_log, infinity) end
+ fun() ->
+ _ = sys:get_status(alog_disk_log, infinity),
+ %% make sure everything actually makes it onto disk
+ ok = disk_log:sync(alog_disk_log),
+ ok
+ end
}.
elog_file({Fmt, Args}) ->
@@ -137,9 +144,9 @@ elog_file({Fmt, Args}) ->
++ "/../deps/elog/ebin"),
application:load(elog),
application:set_env(elog, level, info),
- application:set_env(elog, info, [{logger, {elogger_file, [{file, "logs/elog.log"},
- {size_limit, 10 * 1024 * 1024},
- {date_break, false}]}}]),
+ application:set_env(elog, logger, {elogger_file, [{file, "logs/elog.log"},
+ {size_limit, 10 * 1024 * 1024},
+ {date_break, false}]}),
application:start(elog)
end,
fun() ->
@@ -153,12 +160,9 @@ elog_console({Fmt, Args}) ->
true = code:add_pathz(filename:dirname(escript:script_name())
++ "/../deps/elog/ebin"),
application:load(elog),
- %% force module load order
- code:add_patha("deps/elog/ebin"),
- %% reload the elogger module, as it conflicts with the elogger project
code:load_file(elogger),
application:set_env(elog, level, info),
- application:set_env(elog, info, [{logger, {elogger_console, []}}]),
+ application:set_env(elog, logger, {elogger_console, []}),
application:start(elog)
end,
fun() ->
@@ -176,9 +180,6 @@ elogger_file({Fmt, Args}) ->
%% so elogger can use application:get_env/1
erlang:group_leader(SaslGL, self()),
%% force module load order
- code:add_patha("deps/elogger/ebin"),
- %% reload the elogger module, as it conflicts with the elogger project
- code:load_file(elogger),
application:set_env(kernel, error_logger_mf_file, "logs/elogger"),
application:set_env(kernel, error_logger_mf_maxbytes, 10 * 1024 * 1024),
application:set_env(kernel, error_logger_mf_maxfiles, 5),
@@ -195,14 +196,16 @@ fast_log_file({Fmt, Args}) ->
{fun() ->
true = code:add_pathz(filename:dirname(escript:script_name())
++ "/../deps/fast_log/ebin"),
- code:add_patha("deps/fast_log/ebin"),
application:load(fast_log),
application:set_env(fast_log, loggers, [[{name, fast_logger}, {file, "logs/fast_log.log"}, {file_size, 10 * 1024 * 1024}]]),
error_logger:tty(false),
application:start(sasl),
application:start(fast_log)
end,
fun() -> fast_log:info(fast_logger, token, Fmt, Args) end,
- fun() -> _ = gen_event:which_handlers(fast_logger) end
+ fun() ->
+ %% make sure the gen_event is drained
+ _ = gen_event:which_handlers(fast_logger)
+ end
}.

2 comments on commit 88471b6

It may be too late... but is there a chance you forgot to commit the memgraph file? :P

Owner

Vagabond replied Jul 24, 2014

Heh, I had the commit staged on my laptop, but never pushed.. for a year and 4 months...

Please sign in to comment.