-
Notifications
You must be signed in to change notification settings - Fork 58
/
runtest
executable file
·34 lines (25 loc) · 953 Bytes
/
runtest
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
30
31
32
33
34
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable
-mode(compile).
main([SecondsStr, Server, PortStr, ClientsStr]) ->
Port = list_to_integer(PortStr),
Clients = list_to_integer(ClientsStr),
Seconds = list_to_integer(SecondsStr),
code:add_paths(["deps/folsom/ebin",
"deps/bear/ebin",
"ebin"]),
application:start(folsom),
io:format("Running test with ~p clients for ~p seconds~n",
[Clients, Seconds]),
wsdemo_stats:start_link(Server, Port, Clients),
timer:sleep(Seconds * 1000),
io:format("Result: ~p~n", [wsdemo_stats:stats()]);
main([SecondsStr, ClientsStr]) ->
main([SecondsStr, "localhost", "8000", ClientsStr]);
main(_) ->
usage().
usage() ->
io:format("usage: ~n"
"runtest Seconds::integer() ClientCount::integer() | ~n"
"runtest Seconds::integer() Server::string() Port::integer() ClientCount::integer()~n", []).