pauldick 02/03/29 07:10:58
Modified: test/java/src/org/apache/qetest/xsl PerfTestlet.java
Log:
Added code to calculate KB/s thru put
Revision Changes Path
1.2 +25 -1
xml-xalan/test/java/src/org/apache/qetest/xsl/PerfTestlet.java
Index: PerfTestlet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/PerfTestlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PerfTestlet.java 13 Dec 2001 17:49:38 -0000 1.1
+++ PerfTestlet.java 29 Mar 2002 15:10:58 -0000 1.2
@@ -63,7 +63,9 @@
import org.apache.qetest.xslwrapper.TransformWrapperHelper;
import java.io.File;
+import java.io.FileInputStream;
import java.util.Hashtable;
+import java.text.DecimalFormat;
/**
* Testlet to capture specific timing performance data.
@@ -75,7 +77,7 @@
* transformWrapper will return different sets of timings.
*
* @author [EMAIL PROTECTED]
- * @version $Id: PerfTestlet.java,v 1.1 2001/12/13 17:49:38 curcuru Exp $
+ * @version $Id: PerfTestlet.java,v 1.2 2002/03/29 15:10:58 pauldick Exp $
*/
public class PerfTestlet extends StylesheetTestlet
{
@@ -217,7 +219,29 @@
attrs.put("unparsedxml", new Long(unparsedxml)); // First stylesheet
process during iterations
attrs.put("avgunparsedxml", new Long(avgunparsedxml / iterations));
// Average of stylesheet process during iterations
+ // Additional metrics for data throughput
+ File fIn = new File(datalet.inputName);
+ long btIn = iterations * fIn.length();
+ attrs.put("BytesIn", new Long(btIn));
+
+ // Due to unknown reasons the output needs to be filtered
through a FileInputStream to get it's size.
+ File fOut = new File(datalet.outputName);
+ FileInputStream fOutStrm = new FileInputStream(fOut);
+
+ int len = fOutStrm.available();
+ long btOut = iterations * fOut.length();
+ attrs.put("BytesOut", new Long(btOut));
+ fOutStrm.close();
+
+ // Calculate thruput as Kb/sec. This is based on DataPower code.
+ double thruPut = (double)(1000 * (btIn + btOut)) /
(double)(1024 * 2 * avgparsexsl);
+
+ DecimalFormat fmt = new DecimalFormat("####.##");
+ StringBuffer x = new StringBuffer( fmt.format(thruPut));
+ attrs.put("KBs", x);
+
logger.logElement(Logger.STATUSMSG, "perf", attrs, "PItr;");
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]