Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow outputting stats log to stdout (TSUN-191)

  • Loading branch information...
commit b4168ce07e2e4bb7f998f72305a8faf0cd96597a 1 parent de568f3
@nniclausse nniclausse authored
View
14 doc/tsung.1
@@ -4,7 +4,7 @@
tsung \- A distributed multi-protocol load testing tool.
.SH SYNOPSIS
.sp
-\fBtsung\fR [ \fB-f configuration file\fR ] [ \fB-l log file\fR ] [ \fB-r command\fR ] [ \fB-v\fR ] [ \fB-h\fR ] [ \fBstart|stop|restart|debug|status\fR ]
+\fBtsung\fR [ \fB-f configuration file\fR ] [ \fB-l log dir\fR ] [ \fB-m filename\fR ] [ \fB-r command\fR ] [ \fB-v\fR ] [ \fB-h\fR ] [ \fBstart|stop|debug|status\fR ]
.SH "DESCRIPTION"
.PP
\fBtsung\fR is a distributed load testing
@@ -53,8 +53,13 @@ http://tsung.erlang-projects.org/user_manual.html
\fB-f filename\fR
specifies the configuration file to use. The default file name is \fI~/.tsung/tsung.xml\fR
.TP
-\fB-l logfile\fR
-Specifies the log file to use. The default log file name is \fI~/tsung/log/YYYYMMDD-HHMM/tsung.log\fR
+\fB-l logdir\fR
+Specifies the log directory to use. The default log dir name is \fI~/.tsung/log/YYYYMMDD-HHMM/\fR
+.TP
+\fB-m monitoring_file\fR
+Specifies the monitoring log file name to use. The
+default log file name
+is \fItsung.log\fR\&. Use - for standard output
.TP
\fB-r command\fR
Specifies an alternative to ssh (rsh for ex.) for starting a slave node on a remote host
@@ -66,6 +71,9 @@ several controllers on the same host.
\fB-F\fR
Use long names for erlang nodes (FQDN)
.TP
+\fB-m\fR
+Enable erlang smp on client nodes
+.TP
\fB-v\fR
Show version
.TP
View
23 doc/tsung.1.sgml
@@ -31,11 +31,12 @@ A distributed multi-protocol load testing tool.
<cmdsynopsis>
<command>tsung</command>
<arg><option>-f</option> configuration file</arg>
- <arg><option>-l</option> log file</arg>
+ <arg><option>-l</option> log dir</arg>
+ <arg><option>-m</option> filename</arg>
<arg><option>-r</option> command</arg>
<arg><option>-v</option></arg>
<arg><option>-h</option></arg>
- <arg>start|stop|restart|debug|status</arg>
+ <arg>start|stop|debug|status</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -106,9 +107,17 @@ A distributed multi-protocol load testing tool.
</listitem>
</varlistentry>
<varlistentry>
- <term><option>-l logfile</option></term>
+ <term><option>-l logdir</option></term>
<listitem>
- <para>Specifies the log file to use. The default log file name is <filename>~/tsung/log/YYYYMMDD-HHMM/tsung.log</filename></para>
+ <para>Specifies the log directory to use. The default log dir name is <filename>~/.tsung/log/YYYYMMDD-HHMM/</filename></para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>-m monitoring_file</option></term>
+ <listitem>
+ <para>Specifies the monitoring log file name to use. The
+ default log file name
+ is <filename>tsung.log</filename>. Use - for standard output</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -131,6 +140,12 @@ A distributed multi-protocol load testing tool.
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>-m</option></term>
+ <listitem>
+ <para>Enable erlang smp on client nodes</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>-v</option></term>
<listitem>
<para> Show version</para>
View
6 doc/user_manual.html
@@ -475,10 +475,14 @@ <H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc19">3.4</A>  Running</H3
Usage: tsung &lt;options&gt; start|stop|debug|status
Options:
-f &lt;file&gt; set configuration file (default is ~/.tsung/tsung.xml)
- -l &lt;logdir&gt; set log directory (default is ~/.tsung/log/YYYYMMDD-HHxMM/)
+ -l &lt;logdir&gt; set log directory (default is ~/.tsung/log/YYYYMMDD-HHMM/)
-i &lt;id&gt; set controller id (default is empty)
-r &lt;command&gt; set remote connector (default is ssh)
+ -s enable erlang smp on client nodes
+ -m &lt;file&gt; write monitoring output on this file (default is tsung.log)
+ (use - for standard output)
-F use long names (FQDN) for erlang nodes
+ -w warmup delay (default is 10 sec)
-v print version information and exit
-h display this help and exit
</PRE></TD></TR>
View
6 doc/user_manual.tex
@@ -355,10 +355,14 @@ \subsection{Running}
Usage: tsung <options> start|stop|debug|status
Options:
-f <file> set configuration file (default is ~/.tsung/tsung.xml)
- -l <logdir> set log directory (default is ~/.tsung/log/YYYYMMDD-HHxMM/)
+ -l <logdir> set log directory (default is ~/.tsung/log/YYYYMMDD-HHMM/)
-i <id> set controller id (default is empty)
-r <command> set remote connector (default is ssh)
+ -s enable erlang smp on client nodes
+ -m <file> write monitoring output on this file (default is tsung.log)
+ (use - for standard output)
-F use long names (FQDN) for erlang nodes
+ -w warmup delay (default is 10 sec)
-v print version information and exit
-h display this help and exit
\end{Verbatim}
View
41 src/tsung_controller/ts_mon.erl
@@ -160,22 +160,26 @@ launcher_is_alive() ->
%%----------------------------------------------------------------------
init([LogDir]) ->
?LOGF("Init, log dir is ~p~n",[LogDir],?NOTICE),
- Base = filename:basename(?config(log_file)),
- Filename = filename:join(LogDir, Base),
- case file:open(Filename,[write]) of
- {ok, Stream} ->
- ?LOG("starting monitor~n",?NOTICE),
- Stats = #stats{os_mon = dict:new()},
- {ok, #state{ log = Stream,
- dump_interval = ?config(dumpstats_interval),
- log_dir = LogDir,
- stats = Stats,
- lastdate = now(),
- laststats = Stats
- }};
- {error, Reason} ->
- ?LOGF("Can't open mon log file! ~p~n",[Reason], ?ERR),
- {stop, Reason}
+ Stats = #stats{os_mon = dict:new()},
+ State=#state{ dump_interval = ?config(dumpstats_interval),
+ log_dir = LogDir,
+ stats = Stats,
+ lastdate = now(),
+ laststats = Stats
+ },
+ case ?config(mon_file) of
+ "-" ->
+ {ok, State#state{log=standard_io}};
+ Name ->
+ Filename = filename:join(LogDir, Name),
+ case file:open(Filename,[write]) of
+ {ok, Stream} ->
+ ?LOG("starting monitor~n",?NOTICE),
+ {ok, State#state{log=Stream}};
+ {error, Reason} ->
+ ?LOGF("Can't open mon log file! ~p~n",[Reason], ?ERR),
+ {stop, Reason}
+ end
end.
%%----------------------------------------------------------------------
@@ -362,7 +366,10 @@ terminate(Reason, State) ->
ts_stats_mon:status(ts_stats_mon), % blocking call to ts_stats_mon; this way, we are
% sure the last call to dumpstats is finished
io:format(State#state.log,"EndMonitor:~w~n",[now()]),
- file:close(State#state.log),
+ case State#state.log of
+ standard_io -> ok;
+ Dev -> file:close(Dev)
+ end,
file:close(State#state.fullstats),
slave:stop(node()),
ok.
View
2  src/tsung_controller/tsung_controller.erl
@@ -40,7 +40,7 @@
%%----------------------------------------------------------------------
start(_Type, _StartArgs) ->
error_logger:tty(false),
- {ok, {LogDir, _Name}} = ts_utils:setsubdir(?config(log_file)),
+ {ok, {LogDir, _Name}} = ts_utils:setsubdir(?config(log_dir)),
erlang:display("Log directory is: " ++ LogDir),
LogFile = filename:join(LogDir, atom_to_list(node()) ++ ".log"),
case error_logger:logfile({open, LogFile }) of
View
20 tsung.sh.in
@@ -18,7 +18,8 @@ INSTALL_DIR=@EXPANDED_LIBDIR@/erlang/
ERL=@ERL@
MAIN_DIR=$HOME/.tsung
LOG_DIR=$MAIN_DIR/log
-LOG_OPT="log_file \"$LOG_DIR/tsung.log\""
+LOG_OPT="log_dir \"$LOG_DIR/\""
+MON_FILE="mon_file \"tsung.log\""
VERSION=@PACKAGE_VERSION@
NAMETYPE="-sname"
@@ -73,18 +74,18 @@ start() {
-tsung_controller smp_disable $SMP_DISABLE \
-tsung_controller debug_level $DEBUG_LEVEL \
-tsung_controller warm_time $WARM_TIME \
- -tsung_controller config_file \"$CONF_OPT_FILE\" -tsung_controller $LOG_OPT
+ -tsung_controller config_file \"$CONF_OPT_FILE\" -tsung_controller $LOG_OPT -tsung_controller $MON_FILE
}
debug() {
$ERL $ERL_OPTS $ERL_RSH $NAMETYPE $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
-pa $TSUNGPATH -pa $CONTROLLERPATH \
-tsung_controller config_file \"$CONF_OPT_FILE\" \
- -tsung_controller $LOG_OPT
+ -tsung_controller $LOG_OPT -tsung_controller $MON_FILE
}
version() {
- echo "Tsung version $VERSION"
+ echo "Tsung version $VERSION"
exit 0
}
@@ -130,10 +131,12 @@ usage() {
echo "Usage: $prog <options> start|stop|debug|status"
echo "Options:"
echo " -f <file> set configuration file (default is ~/.tsung/tsung.xml)"
- echo " -l <logdir> set log directory (default is ~/.tsung/log/YYYYMMDD-HHxMM/)"
+ echo " -l <logdir> set log directory (default is ~/.tsung/log/YYYYMMDD-HHMM/)"
echo " -i <id> set controller id (default is empty)"
echo " -r <command> set remote connector (default is ssh)"
echo " -s enable erlang smp on client nodes"
+ echo " -m <file> write monitoring output on this file (default is tsung.log)"
+ echo " (use - for standard output)"
echo " -F use long names (FQDN) for erlang nodes"
echo " -w warmup delay (default is 10 sec)"
echo " -v print version information and exit"
@@ -141,7 +144,7 @@ usage() {
exit
}
-while getopts "vhf:l:d:r:i:Fsw:" Option
+while getopts "vhf:l:d:r:i:Fsw:m:" Option
do
case $Option in
f) CONF_OPT_FILE=$OPTARG;;
@@ -149,11 +152,12 @@ do
echo "$OPTARG" | grep -q "^/"
RES=$?
if [ "$RES" == 0 ]; then
- LOG_OPT="log_file \"$OPTARG/tsung.log\" "
+ LOG_OPT="log_dir \"$OPTARG/\" "
else
- LOG_OPT="log_file \"$PWD/$OPTARG/tsung.log\" "
+ LOG_OPT="log_dir \"$PWD/$OPTARG/\" "
fi
;;
+ m) MON_FILE="mon_file \"$OPTARG\"";;
d) DEBUG_LEVEL=$OPTARG;;
r) ERL_RSH=" -rsh $OPTARG ";;
F) NAMETYPE="-name";;
Please sign in to comment.
Something went wrong with that request. Please try again.