tsung启动使用到了erlang的application中的start_phases方法。
html
在tsung的启动脚本中:shell
$ERL $ERL_OPTS $ERL_RSH -noshell $PROTO_DIST $NAMETYPE $CONTROLLER -setcookie $COOKIE \ -s tsung_controller \ $EXTRA_LOAD_PATHS \
能够知道,tsung使用了tsung_controller模块中的start函数启动的。cookie
而后在tsung_controller.app文件中有定义:app
{start_phases, [{load_config, []},{start_os_monitoring,[{timeout,30000}]}, {start_clients,[]}]}, {mod, {tsung_controller, []}}
这个跟tsung启动脚步对应,tsung_controller模块启动tsung_controller应用,而后启动load_config, start_os_monitoring, start_clients阶段。函数
在app模块中,有说明:测试
start_phases A list of start phases and corresponding start arguments for the application. If this key is present, the application master will - in addition to the usual call to Module:start/2 - also callModule:start_phase(Phase,Type,PhaseArgs) for each start phase defined by the start_phases key, and only after this extended start procedure will application:start(Application) return.
而后看到tsung_controller.erl模块中有:this
start_phase(load_config, _StartType, _PhaseArgs) -》 start_phase(start_os_monitoring, _StartType, _PhaseArgs) -> start_phase(start_clients, _StartType, _PhaseArgs) ->
而后在start_clients阶段中,启动了tsung应用。
code
tsung应用中负责产生负载测试。xml