Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (26 sloc) 1014 Bytes
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable
-mode(compile).
main([LogFile, SecondsStr, Server, PortStr, ClientsStr]) ->
Port = list_to_integer(PortStr),
Clients = list_to_integer(ClientsStr),
Seconds = list_to_integer(SecondsStr),
code:add_paths(["ebin"]),
io:format("Running test with ~p clients for ~p seconds~n"
"Data File: ~p~n",
[Clients, Seconds, LogFile]),
wsdemo_logger:start_link(LogFile),
wsdemo_stats:start_link(Server, Port, Clients),
timer:sleep(Seconds * 1000),
io:format("Finished, syncing stats~n", []),
wsdemo_logger:stop(),
ok;
main([LogFile, SecondsStr, ClientsStr]) ->
main([LogFile, SecondsStr, "localhost", "8000", ClientsStr]);
main(_) ->
usage().
usage() ->
io:format("usage: ~n"
"runtest LogFile::string() Seconds::integer() ClientCount::integer() | ~n"
"runtest LogFile::string() Seconds::integer() Server::string() Port::integer() ClientCount::integer()~n", []).