Skip to content

Instantly share code, notes, and snippets.

@cararemixed
Created September 1, 2015 14:11
Show Gist options
  • Save cararemixed/3dbed67756a6c61d6cf4 to your computer and use it in GitHub Desktop.
Save cararemixed/3dbed67756a6c61d6cf4 to your computer and use it in GitHub Desktop.
-module(bench).
-compile(export_all).
init(_) ->
{ok, null}.
handle_call(ping, _, St) ->
{reply, pong, St}.
start() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
hammer() ->
timer:tc(?MODULE, hammer, [1000000]).
hammer(0) ->
ok;
hammer(N) ->
ping(),
hammer(N-1).
ping() ->
pong = gen_server:call(?MODULE, ping).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment