Permalink
Browse files

dynamic thinktimes (TSUN-168)

  • Loading branch information...
1 parent 720a5ae commit bc9d400fc335e23f8cafb1db0bdd2f4987cbddc8 @nniclausse nniclausse committed Sep 8, 2010
Showing with 35 additions and 3 deletions.
  1. +18 −1 doc/user_manual.html
  2. +6 −0 doc/user_manual.tex
  3. +8 −1 src/tsung/ts_client.erl
  4. +2 −0 src/tsung_controller/ts_config.erl
  5. +1 −1 tsung-1.0.dtd
View
@@ -96,7 +96,7 @@
<!--CUT DEF section 1 --><H1 ALIGN=center>Tsung User’s manual</H1><DIV CLASS="center">
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1><TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Version:</TD><TD ALIGN=left NOWRAP>1.3.3</TD></TR>
-<TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Date :</TD><TD ALIGN=left NOWRAP>September 2, 2010</TD></TR>
+<TR><TD ALIGN=left NOWRAP bgcolor="#F2F2F2"> Date :</TD><TD ALIGN=left NOWRAP>September 8, 2010</TD></TR>
</TABLE>
</DIV><!--TOC section Contents-->
<H2 CLASS="section"><!--SEC ANCHOR -->Contents</H2><!--SEC END --><UL CLASS="toc"><LI CLASS="li-toc">
@@ -1305,6 +1305,23 @@ <H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc55">6.6.1</A>  Thinkt
</TD></TR>
</TABLE></TD></TR>
</TABLE></TD></TR>
+</TABLE><P><B>Since version 1.4.0</B>, you can use a dynamic variable to set
+the thinktime value:
+</P><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE BORDER=0 CELLPADDING=0
+CELLSPACING=0><TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD><TD><TABLE BORDER=0 CELLPADDING="1" CELLSPACING=0><TR><TD><PRE CLASS="verbatim">&lt;thinktime value='%%_rndthink%%' random='true'&gt;&lt;/thinktime&gt;
+</PRE></TD></TR>
+</TABLE></TD><TD BGCOLOR=black COLSPAN="1"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+<TR><TD BGCOLOR=black COLSPAN="3"><TABLE CELLSPACING="1" CELLPADDING=0 BORDER=0><TR><TD>
+</TD></TR>
+</TABLE></TD></TR>
+</TABLE></TD></TR>
</TABLE><!--TOC subsubsection HTTP-->
<H4 CLASS="subsubsection"><!--SEC ANCHOR --><A NAME="htoc56">6.6.2</A>  HTTP</H4><!--SEC END --><P>This example shows several features of the HTTP protocol support in
Tsung: GET and POST request, basic authentication, transaction for
View
@@ -1091,6 +1091,12 @@ \subsubsection{Thinktimes}
<thinktime min="2" max="10" random="true"></thinktime>
\end{Verbatim}
+\strong{Since version 1.4.0}, you can use a dynamic variable to set
+the thinktime value:
+\begin{Verbatim}
+<thinktime value='%%_rndthink%%' random='true'></thinktime>
+\end{Verbatim}
+
\subsubsection{HTTP}
View
@@ -350,7 +350,14 @@ handle_next_action(State=#state_rcv{count=0}) ->
handle_next_action(State) ->
Count = State#state_rcv.count-1,
case set_profile(State#state_rcv.maxcount,State#state_rcv.count,State#state_rcv.session_id) of
- {thinktime, Think} ->
+ {thinktime, TmpThink} ->
+ Think = case TmpThink of
+ "%%"++_Tail ->
+ Raw=ts_search:subst(TmpThink,(State#state_rcv.dyndata)#dyndata.dynvars),
+ ts_utils:list_to_number(Raw)*1000;
+ Val ->
+ Val
+ end,
?DebugF("Starting new thinktime ~p~n", [Think]),
case (set_thinktime(Think) >= State#state_rcv.hibernate) of
true ->
@@ -703,6 +703,8 @@ parse(Element = #xmlElement{name=thinktime, attributes=Attrs},
{RT,T} = case getAttr(Attrs, value) of
"wait_global" ->
{wait_global,infinity};
+ "%%"++Tail -> % dynamic thinktime
+ {"%%"++Tail,"%%"++Tail};
_ ->
DefThink = get_default(Tab,{thinktime, value},thinktime_value),
DefRandom = get_default(Tab,{thinktime, random},thinktime_random),
View
@@ -136,7 +136,7 @@ repeat | if | change_type | foreach)*>
<!ELEMENT thinktime EMPTY>
<!ATTLIST thinktime
random (true|false) "false"
- value NMTOKEN #IMPLIED
+ value CDATA #IMPLIED
min NMTOKEN #IMPLIED
max NMTOKEN #IMPLIED
>

0 comments on commit bc9d400

Please sign in to comment.