You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/05/02 00:08:47 UTC

svn commit: r398708 - in /jakarta/jmeter/branches/rel-2-1: src/core/org/apache/jmeter/JMeter.java xdocs/usermanual/functions.xml

Author: sebb
Date: Mon May  1 15:08:46 2006
New Revision: 398708

URL: http://svn.apache.org/viewcvs?rev=398708&view=rev
Log:
Define START.xxx properties; document internal JMeter variables

Modified:
    jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java
    jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/functions.xml

Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java?rev=398708&r1=398707&r2=398708&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/JMeter.java Mon May  1 15:08:46 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2004 The Apache Software Foundation.
+ * Copyright 2000-2004,2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@
 import java.net.Authenticator;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -253,6 +255,15 @@
                 String jcp=System.getProperty("java.class.path");// $NON-NLS-1$
                 log.debug(jcp);
             }
+
+            // Set some (hopefully!) useful properties
+            long now=System.currentTimeMillis();
+            JMeterUtils.setProperty("START.MS",Long.toString(now));
+            Date today=new Date(now); // so it agrees with above
+            // TODO perhaps should share code with __time() function for this...
+            JMeterUtils.setProperty("START.YMD",new SimpleDateFormat("yyyyMMdd").format(today));
+            JMeterUtils.setProperty("START.HMS",new SimpleDateFormat("HHmmss").format(today));
+            
 			if (parser.getArgumentById(VERSION_OPT) != null) {
 				System.out.println(JMeterUtils.getJMeterCopyright());
 				System.out.println("Version " + JMeterUtils.getJMeterVersion());

Modified: jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/functions.xml
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/functions.xml?rev=398708&r1=398707&r2=398708&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/functions.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/usermanual/functions.xml Mon May  1 15:08:46 2006
@@ -41,14 +41,18 @@
 <section name="&sect-num;. Functions" anchor="functions">
 <p>
 JMeter functions are special values that can populate fields of any Sampler or other configuration
-element in a test tree.  A function looks like this:</p>
+element in a test tree.  A function call looks like this:</p>
 
 <p><code>${__functionName(var1,var2,var3)}</code></p>
 
-<p>Where "__functionName" matches the name of an existing built-in or user-defined function.<br></br>
-Parentheses surround the parameters sent to the function.  The actual parameters vary from function 
-to function.  Functions that require no parameters can leave off the parentheses.  The function itself
-is wrapped in ${}.</p>
+<p>
+Where "__functionName" matches the name of a function.
+<br></br>
+Parentheses surround the parameters sent to the function, for example ${__time(YMD)}
+The actual parameters vary from function to function.  
+Functions that require no parameters can leave off the parentheses, for example ${__threadNum}.
+</p>
+
 <p>List of functions:</p>
 <ul>
         <li><a href="#__regexFunction">regexFunction - regular expression evaluator</a></li>
@@ -72,7 +76,7 @@
 </ul>
 
 <subsection name="&sect-num;.1 What can functions do" anchor="what_can_do">
-<p>There are two kinds of functions: user-defined static values, and built-in functions.<br></br>
+<p>There are two kinds of functions: user-defined static values (or variables), and built-in functions.<br></br>
 User-defined static values allow the user to define variables to be replaced with their static value when
 a test tree is compiled and submitted to be run.  This replacement happens once at the beginning of the test
 run.  This could be used to replace the DOMAIN field of all HTTP requests, for example - making it a simple 
@@ -670,6 +674,28 @@
 
 </subsection>
 
+<subsection name="&sect-num;.6 Pre-defined Variables" anchor="predefinedvars">
+<p>
+Most variables are set by calling functions or by test elements such as User Defined Variables; 
+in which case the user has full control over the variable name that is used.
+However some variables are defined internally by JMeter. These are listed below.
+</p>
+<ul>
+<li>cookiename - contains the cookie value</li>
+<li>JMeterThread.last_sample_ok - whether or not the last sample was OK - true/false</li>
+</ul>
+</subsection>
+<subsection name="&sect-num;.6 Pre-defined Properties" anchor="predefinedprops">
+<p>
+Properties are defined in jmeter.properties, or on the command line.
+Some additional properties are defined by JMeter. These are listed below.
+</p>
+<ul>
+<li>START.MS - start time in milliseconds</li>
+<li>START.YMD - start time as yyyyMMdd</li>
+<li>START.HMS - start time as HHmmss</li>
+</ul>
+</subsection>
 </section>
 
 </body>



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org