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