Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add gen_server to choose local ports to bypass the 64K limit.

  • Loading branch information...
commit c1163bd53427d1dbfe26ac32fcfc4ec7661acaf9 1 parent 239c2c3
Nicolas Niclausse nniclausse authored
8 src/test/ts_test_config.erl
@@ -113,14 +113,6 @@ read_config_maxusers_test() ->
113 113 {ok,{[{_,Max4},{_,_}],_,_}}=ts_config_server:get_client_config("client4"),
114 114 ?assert(Max1+Max2+Max3+Max4 =< MaxNumber).
115 115
116   -choose_port_test() ->
117   - myset_env(),
118   - {Dict,3} = ts_config_server:choose_port('client',undefined,{3,5}),
119   - {Dict2,4} = ts_config_server:choose_port('client',Dict,{3,5}),
120   - {Dict3,5} = ts_config_server:choose_port('client',Dict2,{3,5}),
121   - {Dict4,3} = ts_config_server:choose_port('client2',Dict3,{3,5}),
122   - ?assertMatch({_,3}, ts_config_server:choose_port('client',Dict4,{3,5})).
123   -
124 116 myset_env()->
125 117 myset_env(0).
126 118 myset_env(Level)->
45 src/tsung/ts_client.erl
@@ -40,6 +40,9 @@
40 40 -define(MAX_RETRIES,3). % max number of connection retries
41 41 -define(RETRY_TIMEOUT,10000). % waiting time between retries (msec)
42 42
  43 +-define(CLIENT_PORT_MIN,1025).
  44 +-define(CLIENT_PORT_MAX,65535).
  45 +
43 46 %% External exports
44 47 -export([start/1, next/1]).
45 48
@@ -95,6 +98,13 @@ init({#session{id = SessionId,
95 98 NewDynData = DynData#dyndata{dynvars=NewDynVars},
96 99 StartTime= now(),
97 100 set_thinktime(?short_timeout),
  101 + NewIP = case IP of
  102 + { RealIP, -1 } ->
  103 + {ok, MyHostName} = ts_utils:node_to_hostname(node()),
  104 + {RealIP, "cport-" ++ MyHostName};
  105 + Val ->
  106 + Val
  107 + end,
98 108 {ok, think, #state_rcv{ port = Server#server.port,
99 109 host = Server#server.host,
100 110 session_id = SessionId,
@@ -107,7 +117,7 @@ init({#session{id = SessionId,
107 117 dump = ?config(dump),
108 118 proto_opts = ProtoOpts,
109 119 count = Count,
110   - ip = IP,
  120 + ip = NewIP,
111 121 id = Id,
112 122 hibernate = Hibernate,
113 123 maxcount = Count,
@@ -599,7 +609,8 @@ handle_next_request(Request, State) ->
599 609 host=Host,
600 610 port=Port});
601 611 {error, Reason} ->
602   - ?LOGF("Error: Unable to send data, reason: ~p~n",[Reason],?ERR),
  612 + %% LOG only at INFO level since we report also an error to ts_mon
  613 + ?LOGF("Error: Unable to send data, reason: ~p~n",[Reason],?INFO),
603 614 CountName="error_send_"++atom_to_list(Reason),
604 615 ts_mon:add({ count, list_to_atom(CountName) }),
605 616 handle_timeout_while_sending(State);
@@ -703,7 +714,9 @@ set_profile(MaxCount, Count, ProfileId) when is_integer(ProfileId) ->
703 714 %% {stop, Reason}
704 715 %% purpose: try to reconnect if this is needed (when the socket is set to none)
705 716 %%----------------------------------------------------------------------
706   -reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,CPort}) ->
  717 +reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,0}) ->
  718 + reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,0,0});
  719 +reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,CPort, Try}) when is_integer(CPort)->
707 720 ?DebugF("Try to (re)connect to: ~p:~p from ~p using protocol ~p~n",
708 721 [ServerName,Port,IP,Protocol]),
709 722 Opts = protocol_options(Protocol, Proto_opts) ++ [{ip, IP},{port,CPort}],
@@ -716,16 +729,32 @@ reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,CPort}) ->
716 729 ?Debug("(Re)connected~n"),
717 730 {ok, Socket};
718 731 {error, Reason} ->
719   - {A,B,C,D} = IP,
720   - ?LOGF("(Re)connect from ~p.~p.~p.~p to ~s:~p, Error: ~p~n",
721   - [A,B,C,D, ServerName, Port, Reason],?ERR),
722   - CountName="error_connect_"++atom_to_list(Reason),
723   - ts_mon:add({ count, list_to_atom(CountName) }),
  732 + {A,B,C,D} = IP,
  733 + %% LOG only at INFO level since we report also an error to ts_mon
  734 + ?LOGF("(Re)connect from ~p.~p.~p.~p:~p to ~s:~p, Error: ~p~n",
  735 + [A,B,C,D, CPort, ServerName, Port , Reason],?INFO),
  736 + case {Reason,CPort,Try} of
  737 + {eaddrinuse, Val,CPortServer} when Val == 0; CPortServer == undefined ->
  738 + %% already retry once, don't try again.
  739 + ts_mon:add({ count, error_connect_eaddrinuse });
  740 + {eaddrinuse, Val,CPortServer} when Val > 0 ->
  741 + %% retry once when tsung allocates port number
  742 + NewCPort = ts_cport:get_port(CPortServer,IP),
  743 + ?LOGF("Connect failed with client port ~p, retry with ~p~n",[CPort, NewCPort],?INFO),
  744 + reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,NewCPort, undefined});
  745 + _ ->
  746 + CountName="error_connect_"++atom_to_list(Reason),
  747 + ts_mon:add({ count, list_to_atom(CountName) })
  748 + end,
724 749 {error, Reason}
725 750 end;
  751 +reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,CPortServer}) ->
  752 + CPort = ts_cport:get_port(CPortServer,IP),
  753 + reconnect(none, ServerName, Port, {Protocol, Proto_opts}, {IP,CPort,CPortServer});
726 754 reconnect(Socket, _Server, _Port, _Protocol, _IP) ->
727 755 {ok, Socket}.
728 756
  757 +
729 758 %%----------------------------------------------------------------------
730 759 %% Func: send/5
731 760 %% Purpose: wrapper function for send
158 src/tsung/ts_cport.erl
... ... @@ -0,0 +1,158 @@
  1 +%%%
  2 +%%% Copyright 2009 � Nicolas Niclausse
  3 +%%%
  4 +%%% Author : Nicolas Niclausse <nicolas.nniclausse@niclux.org>
  5 +%%% Created: 17 mar 2009 by Nicolas Niclausse <nicolas.nniclausse@niclux.org>
  6 +%%%
  7 +%%% This program is free software; you can redistribute it and/or modify
  8 +%%% it under the terms of the GNU General Public License as published by
  9 +%%% the Free Software Foundation; either version 2 of the License, or
  10 +%%% (at your option) any later version.
  11 +%%%
  12 +%%% This program is distributed in the hope that it will be useful,
  13 +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +%%% GNU General Public License for more details.
  16 +%%%
  17 +%%% You should have received a copy of the GNU General Public License
  18 +%%% along with this program; if not, write to the Free Software
  19 +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  20 +%%%
  21 +%%% In addition, as a special exception, you have the permission to
  22 +%%% link the code of this program with any library released under
  23 +%%% the EPL license and distribute linked combinations including
  24 +%%% the two.
  25 +
  26 +-module(ts_cport).
  27 +-vc('$Id: ts_cport.erl,v 0.0 2009/03/17 10:26:56 nniclaus Exp $ ').
  28 +-author('nniclausse@niclux.org').
  29 +
  30 +-behaviour(gen_server).
  31 +
  32 +-include("ts_profile.hrl").
  33 +
  34 +%% API
  35 +-export([start_link/0, get_port/2]).
  36 +
  37 +%% gen_server callbacks
  38 +-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
  39 + terminate/2, code_change/3]).
  40 +
  41 +-define(EPMD_PORT,4369).
  42 +
  43 +-record(state, {
  44 + max_port = 1025,
  45 + min_port = 65535
  46 + }).
  47 +
  48 +%%====================================================================
  49 +%% API
  50 +%%====================================================================
  51 +%%--------------------------------------------------------------------
  52 +%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
  53 +%% Description: Starts the server
  54 +%%--------------------------------------------------------------------
  55 +start_link() ->
  56 + gen_server:start_link(?MODULE, [], []).
  57 +
  58 +
  59 +get_port(CPortServer,IP)->
  60 + gen_server:call({global,CPortServer},{get,IP}).
  61 +
  62 +%%====================================================================
  63 +%% gen_server callbacks
  64 +%%====================================================================
  65 +
  66 +%%--------------------------------------------------------------------
  67 +%% Function: init(Args) -> {ok, State} |
  68 +%% {ok, State, Timeout} |
  69 +%% ignore |
  70 +%% {stop, Reason}
  71 +%% Description: Initiates the server
  72 +%%--------------------------------------------------------------------
  73 +init([]) ->
  74 + %% registering can be long (global:sync needed), do it after the
  75 + %% init phase FIXME: maybe we could use phase_start of OTP ?
  76 + %% instead of using timeout
  77 +
  78 + {Min, Max} = {?config(cport_min),?config(cport_max)},
  79 + ts_utils:init_seed(),
  80 + %% set random port for the initial value.
  81 + case catch Min+random:uniform(Max-Min) of
  82 + Val when is_integer(Val) ->
  83 + ?LOGF("Ok, starting with ~p value~n",[Val],?ERR),
  84 + {ok, #state{min_port=Min, max_port=Max},10};
  85 + Err ->
  86 + ?LOGF("ERR starting: ~p~n",[Err],?ERR),
  87 + {ok, #state{}}
  88 + end.
  89 +
  90 +%%--------------------------------------------------------------------
  91 +%% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} |
  92 +%% {reply, Reply, State, Timeout} |
  93 +%% {noreply, State} |
  94 +%% {noreply, State, Timeout} |
  95 +%% {stop, Reason, Reply, State} |
  96 +%% {stop, Reason, State}
  97 +%% Description: Handling call messages
  98 +%%--------------------------------------------------------------------
  99 +handle_call({get, ClientIP}, _From, State) ->
  100 + %% use the process dictionnary to store tha last port of each ip
  101 + %% should we use ets instead ?
  102 + Reply = case get(ClientIP) of
  103 + ?EPMD_PORT ->
  104 + ?EPMD_PORT + 1;
  105 + Val when Val > State#state.max_port ->
  106 + State#state.min_port;
  107 + Val ->
  108 + Val
  109 + end,
  110 + put(ClientIP,Reply+1),
  111 + ?LOGF("Give port number ~p to IP ~p~n",[Reply,ClientIP],?DEB),
  112 + {reply, Reply, State}.
  113 +
  114 +%%--------------------------------------------------------------------
  115 +%% Function: handle_cast(Msg, State) -> {noreply, State} |
  116 +%% {noreply, State, Timeout} |
  117 +%% {stop, Reason, State}
  118 +%% Description: Handling cast messages
  119 +%%--------------------------------------------------------------------
  120 +handle_cast(_Msg, State) ->
  121 + {noreply, State}.
  122 +
  123 +%%--------------------------------------------------------------------
  124 +%% Function: handle_info(Info, State) -> {noreply, State} |
  125 +%% {noreply, State, Timeout} |
  126 +%% {stop, Reason, State}
  127 +%% Description: Handling all non call/cast messages
  128 +%%--------------------------------------------------------------------
  129 +handle_info(timeout, State) ->
  130 + %% several beam can be started in a host: we want a single cport
  131 + %% server to respond: register a name unique to the host
  132 + {ok, MyHostName} = ts_utils:node_to_hostname(node()),
  133 + Id="cport-" ++ MyHostName,
  134 + global:sync(),
  135 + global:register_name(Id,self(),{global, random_notify_name}),
  136 + {noreply, State}.
  137 +
  138 +%%--------------------------------------------------------------------
  139 +%% Function: terminate(Reason, State) -> void()
  140 +%% Description: This function is called by a gen_server when it is about to
  141 +%% terminate. It should be the opposite of Module:init/1 and do any necessary
  142 +%% cleaning up. When it returns, the gen_server terminates with Reason.
  143 +%% The return value is ignored.
  144 +%%--------------------------------------------------------------------
  145 +terminate(_Reason, _State) ->
  146 + ok.
  147 +
  148 +%%--------------------------------------------------------------------
  149 +%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}
  150 +%% Description: Convert process state when code is changed
  151 +%%--------------------------------------------------------------------
  152 +code_change(_OldVsn, State, _Extra) ->
  153 + {ok, State}.
  154 +
  155 +%%--------------------------------------------------------------------
  156 +%%% Internal functions
  157 +%%--------------------------------------------------------------------
  158 +
6 src/tsung/ts_launcher.erl
@@ -376,10 +376,14 @@ do_launch({Intensity, MyHostName})->
376 376 %% Check if global names are synced; Annoying "feature" of R10B7 and up
377 377 check_registered() ->
378 378 case global:registered_names() of
  379 + ["cport"++_Tail] ->
  380 + ?LOG("Only cport server registered ! syncing ...~n", ?WARN),
  381 + global:sync();
379 382 [] ->
380 383 ?LOG("No registered processes ! syncing ...~n", ?WARN),
381 384 global:sync();
382   - _ -> ok
  385 + _ ->
  386 + ok
383 387 end.
384 388
385 389 set_warm_timeout(StartDate)->
4 src/tsung/ts_sup.erl
@@ -65,11 +65,13 @@ init([]) ->
65 65 transient, 2000, worker, [ts_launcher_static]},
66 66 LauncherManager = {ts_launcher_mgr, {ts_launcher_mgr, start, []},
67 67 transient, 2000, worker, [ts_launcher_mgr]},
  68 + PortServer = {ts_cport, {ts_cport, start_link, []},
  69 + transient, 2000, worker, [ts_cport]},
68 70 SessionCache = {ts_session_cache, {ts_session_cache, start, []},
69 71 transient, 2000, worker, [ts_session_cache]},
70 72 MonCache = {ts_mon_cache, {ts_mon_cache, start, []},
71 73 transient, 2000, worker, [ts_mon_cache]},
72   - {ok,{{one_for_one,?retries,10}, [LauncherManager, SessionCache, MonCache,ClientsSup, StaticLauncher,Launcher ]}}.
  74 + {ok,{{one_for_one,?retries,10}, [PortServer,LauncherManager, SessionCache, MonCache,ClientsSup, StaticLauncher,Launcher ]}}.
73 75
74 76 %%%----------------------------------------------------------------------
75 77 %%% Internal functions
10 src/tsung/ts_utils.erl
@@ -306,13 +306,21 @@ erl_system_args(extended)->
306 306 " -kernel inetrc '"++ InetRcFile ++ "'" ;
307 307 _ -> " "
308 308 end,
  309 + ListenMin = case application:get_env(kernel,inet_dist_listen_min) of
  310 + undefined -> "";
  311 + {ok, Min} -> " -kernel inet_dist_listen_min " ++ integer_to_list(Min)++ " "
  312 + end,
  313 + ListenMax = case application:get_env(kernel,inet_dist_listen_max) of
  314 + undefined -> "";
  315 + {ok, Max} -> " -kernel inet_dist_listen_max " ++ integer_to_list(Max)++" "
  316 + end,
309 317 Threads= "+A "++integer_to_list(erlang:system_info(thread_pool_size))++" ",
310 318 ProcessMax="+P "++integer_to_list(erlang:system_info(process_limit))++" ",
311 319 Mea = case erlang:system_info(version) of
312 320 "5.3" ++ _Tail -> " +Mea r10b ";
313 321 _ -> " "
314 322 end,
315   - lists:append([BasicArgs, Shared, Hybrid, Smp, Mea, Inet, Threads,ProcessMax]).
  323 + lists:append([BasicArgs, Shared, Hybrid, Smp, Mea, Inet, Threads,ProcessMax,ListenMin,ListenMax]).
316 324
317 325 %%----------------------------------------------------------------------
318 326 %% setsubdir/1
2  src/tsung/tsung.erl
@@ -50,7 +50,7 @@ start(_Type, _StartArgs) ->
50 50 {ok, Pid} ->
51 51 {ok, Pid};
52 52 Error ->
53   - ?LOGF("Can't start ! ~p ~n",[Error],?ERR),
  53 + ?LOGF("Can't start supervisor ! ~p ~n",[Error],?ERR),
54 54 Error
55 55 end.
56 56
42 src/tsung_controller/ts_config_server.erl
@@ -237,7 +237,6 @@ handle_call({get_req, Id, N}, _From, State) ->
237 237 {reply, {error, Other}, State}
238 238 end;
239 239
240   -%%
241 240 handle_call({get_user_agents}, _From, State) ->
242 241 Config = State#state.config,
243 242 case ets:lookup(Config#config.session_tab, {http_user_agent, value}) of
@@ -248,15 +247,15 @@ handle_call({get_user_agents}, _From, State) ->
248 247 end;
249 248
250 249 %% get user parameters (static user: the session id is already known)
251   -handle_call({get_user_param, HostName}, _From, State=#state{users=UserId,ports=Ports}) ->
  250 +handle_call({get_user_param, HostName}, _From, State=#state{users=UserId}) ->
252 251 Config = State#state.config,
253 252 {value, Client} = lists:keysearch(HostName, #client.host, Config#config.clients),
254   - {IPParam, Server, NewPorts} = get_user_param(Client,Config,Ports),
  253 + {IPParam, Server} = get_user_param(Client,Config),
255 254 ts_mon:newclient({static,now()}),
256   - {reply, {ok, { IPParam, Server, UserId}}, State#state{users=UserId+1,ports=NewPorts}};
  255 + {reply, {ok, { IPParam, Server, UserId}}, State#state{users=UserId+1}};
257 256
258 257 %% get a new session id and user parameters for the given node
259   -handle_call({get_next_session, HostName}, _From, State=#state{users=Users,ports=Ports}) ->
  258 +handle_call({get_next_session, HostName}, _From, State=#state{users=Users}) ->
260 259 Config = State#state.config,
261 260 {value, Client} = lists:keysearch(HostName, #client.host, Config#config.clients),
262 261 ?DebugF("get new session for ~p~n",[_From]),
@@ -264,9 +263,9 @@ handle_call({get_next_session, HostName}, _From, State=#state{users=Users,ports=
264 263 {ok, Session=#session{id=Id}} ->
265 264 ?LOGF("Session ~p choosen~n",[Id],?INFO),
266 265 ts_mon:newclient({Id,now()}),
267   - {IPParam, Server, NewPorts} = get_user_param(Client,Config,Ports),
  266 + {IPParam, Server} = get_user_param(Client,Config),
268 267 {reply, {ok, {Session, IPParam, Server, Users}},
269   - State#state{users=Users+1,ports=NewPorts}};
  268 + State#state{users=Users+1}};
270 269 Other ->
271 270 {reply, {error, Other}, State}
272 271 end;
@@ -379,13 +378,19 @@ handle_cast({newbeam, Host, Arrivals}, State=#state{last_beam_id = NodeId}) ->
379 378 {ok, Boot, _} = regexp:gsub(BootController,"tsung_controller","tsung"),
380 379 ?DebugF("Boot ~p~n", [Boot]),
381 380 Sys_Args= ts_utils:erl_system_args(),
  381 + Ports = case (State#state.config)#config.ports_range of
  382 + {Min, Max} ->
  383 + " -tsung cport_min " ++ integer_to_list(Min) ++ " -tsung cport_max " ++ integer_to_list(Max);
  384 + undefined ->
  385 + ""
  386 + end,
382 387 LogDir = encode_filename(State#state.logdir),
383 388 Args = lists:flatten([ Sys_Args," -boot ", Boot,
384 389 " -boot_var ", ?TSUNGPATH, " ",PathVar, PA,
385 390 " +K true ",
386 391 " -tsung debug_level ", integer_to_list(?config(debug_level)),
387 392 " -tsung dump ", atom_to_list(?config(dump)),
388   - " -tsung log_file ", LogDir
  393 + " -tsung log_file ", LogDir, Ports
389 394 ]),
390 395 ?LOGF("starting newbeam on host ~p from ~p with Args ~p~n", [Host, State#state.hostname, Args], ?INFO),
391 396 Seed=(State#state.config)#config.seed,
@@ -441,11 +446,11 @@ set_start_date(undefined)->
441 446 ts_utils:add_time(now(), ?config(warm_time));
442 447 set_start_date(Date) -> Date.
443 448
444   -get_user_param(Client,Config,Ports)->
  449 +get_user_param(Client,Config)->
445 450 {ok,IP} = choose_client_ip(Client),
446 451 {ok, Server} = choose_server(Config#config.servers),
447   - {NewPorts,CPort} = choose_port(IP, Ports,Config#config.ports_range),
448   - { {IP, CPort}, Server, NewPorts}.
  452 + CPort = choose_port(IP, Config#config.ports_range),
  453 + { {IP, CPort}, Server}.
449 454
450 455 %%----------------------------------------------------------------------
451 456 %% Func: choose_client_ip/1
@@ -681,19 +686,8 @@ start_slave(Host, Name, Args, Arrivals, Seed)->
681 686 exit({slave_failure, Reason})
682 687 end.
683 688
684   -choose_port(_,_, undefined) ->
685   - {[],0};
686   -choose_port(Client,undefined, Range) ->
687   - choose_port(Client,dict:new(), Range);
688   -choose_port(ClientIp,Ports, {Min, Max}) ->
689   - case dict:find(ClientIp,Ports) of
690   - {ok, Val} when Val =< Max ->
691   - NewPorts=dict:update_counter(ClientIp,1,Ports),
692   - {NewPorts,Val};
693   - _ -> % Max Reached or new entry
694   - NewPorts=dict:store(ClientIp,Min+1,Ports),
695   - {NewPorts,Min}
696   - end.
  689 +choose_port(_,undefined) -> 0;
  690 +choose_port(_, _Range) -> -1.
697 691
698 692 %% @spec session_name_to_session(Sessions::list(), Static::list() ) -> StaticUsers::list()
699 693 %% @doc convert session name to session id in static users list
19 tsung.sh.in
@@ -2,7 +2,14 @@
2 2
3 3 UNAME=`uname`
4 4 case $UNAME in
5   - "Linux") HOST=`hostname -s`;;
  5 + "Linux")
  6 + HOST=`hostname -s 2>/dev/null`
  7 + RET=$?
  8 + if [ $RET != 0 ]; then
  9 + HOST=`hostname`
  10 + echo "WARN: hostname -s failed, use '$HOST' as hostname" > /dev/stderr
  11 + fi
  12 + ;;
6 13 "SunOS") HOST=`hostname`;;
7 14 *) HOST=`hostname -s`;;
8 15 esac
@@ -22,6 +29,7 @@ PGSQL_SERVER_PORT=5432
22 29 NAME=tsung
23 30 CONTROLLER=tsung_controller
24 31 SMP_DISABLE=true
  32 +WARM_TIME=10
25 33
26 34 TSUNGPATH=$INSTALL_DIR/lib/tsung-$VERSION/ebin
27 35 CONTROLLERPATH=$INSTALL_DIR/lib/tsung_controller-$VERSION/ebin
@@ -30,7 +38,8 @@ CONF_OPT_FILE="$HOME/.tsung/tsung.xml"
30 38 BOOT_OPT="-boot $INSTALL_DIR/lib/tsung_controller-$VERSION/priv/tsung_controller -boot_var TSUNGPATH $INSTALL_DIR "
31 39 DEBUG_LEVEL=5
32 40 ERL_RSH=" -rsh ssh "
33   -ERL_OPTS=" -smp auto +P 250000 +A 256 +K true @ERL_OPTS@ "
  41 +ERL_DIST_PORTS=" -kernel inet_dist_listen_min 64000 -kernel inet_dist_listen_max 65500 "
  42 +ERL_OPTS=" $ERL_DIST_PORTS -smp auto +P 250000 +A 256 +K true @ERL_OPTS@ "
34 43 COOKIE='tsung'
35 44 ERTS_RUN=`$ERL -version 2>&1 | tr -cd 0123456789.`
36 45 ERTS_BOOT=`grep erts $TSUNGPATH/../priv/tsung.rel 2> /dev/null| tr -cd 0123456789.`
@@ -63,6 +72,7 @@ start() {
63 72 -pa $TSUNGPATH -pa $CONTROLLERPATH \
64 73 -tsung_controller smp_disable $SMP_DISABLE \
65 74 -tsung_controller debug_level $DEBUG_LEVEL \
  75 + -tsung_controller warm_time $WARM_TIME \
66 76 -tsung_controller config_file \"$CONF_OPT_FILE\" -tsung_controller $LOG_OPT
67 77 }
68 78
@@ -122,15 +132,17 @@ usage() {
122 132 echo " -f <file> set configuration file (default is ~/.tsung/tsung.xml)"
123 133 echo " -l <logfile> set log file (default is ~/.tsung/log/YYYYMMDD-HH:MM/tsung.log)"
124 134 echo " -i <id> set controller id (default is empty)"
  135 + echo " -i <id> set controller id (default is empty)"
125 136 echo " -r <command> set remote connector (default is ssh)"
126 137 echo " -s enable erlang smp on client nodes"
127 138 echo " -F use long names (FQDN) for erlang nodes"
  139 + echo " -w warmup delay (default is 10 sec)"
128 140 echo " -v print version information and exit"
129 141 echo " -h display this help and exit"
130 142 exit
131 143 }
132 144
133   -while getopts "vhf:l:d:r:i:Fs" Option
  145 +while getopts "vhf:l:d:r:i:Fsw:" Option
134 146 do
135 147 case $Option in
136 148 f) CONF_OPT_FILE=$OPTARG;;
@@ -146,6 +158,7 @@ do
146 158 d) DEBUG_LEVEL=$OPTARG;;
147 159 r) ERL_RSH=" -rsh $OPTARG ";;
148 160 F) NAMETYPE="-name";;
  161 + w) WARM_TIME=$OPTARG;;
149 162 s) SMP_DISABLE="false";;
150 163 v) version;;
151 164 i) ID=$OPTARG

0 comments on commit c1163bd

Please sign in to comment.
Something went wrong with that request. Please try again.