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 2007/03/02 22:16:04 UTC
svn commit: r513957 -
/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java
Author: sebb
Date: Fri Mar 2 13:16:04 2007
New Revision: 513957
URL: http://svn.apache.org/viewvc?view=rev&rev=513957
Log:
Remove all String routines; formatting is now done by the Renderers
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java
Modified: jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java?view=diff&rev=513957&r1=513956&r2=513957
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/Calculator.java Fri Mar 2 13:16:04 2007
@@ -18,8 +18,6 @@
package org.apache.jmeter.util;
-import java.text.DecimalFormat;
-
import org.apache.jmeter.samplers.SampleResult;
/**
@@ -31,12 +29,6 @@
*/
public class Calculator {
- private static DecimalFormat rateFormatter = new DecimalFormat("#.0");
-
- private static DecimalFormat errorFormatter = new DecimalFormat("#0.00%");
-
- private static DecimalFormat kbFormatter = new DecimalFormat("#0.00");
-
private double sum = 0;
private double sumOfSquares = 0;
@@ -58,7 +50,7 @@
private final String label;
public Calculator() {
- this.label = "";
+ this("");
}
public Calculator(String label) {
@@ -163,22 +155,6 @@
}
/**
- * Returns a String which represents the percentage of sample errors that
- * have occurred. ("0.00%" through "100.00%")
- *
- * @return a String which represents the percentage of sample errors that
- * have occurred.
- */
- public String getErrorPercentageString() {
- double myErrorPercentage = this.getErrorPercentage();
- if (myErrorPercentage < 0) {
- myErrorPercentage = 0.0;
- }
-
- return (errorFormatter.format(myErrorPercentage));
- }
-
- /**
* Returns the throughput associated to this sampler in requests per second.
* May be slightly skewed because it takes the timestamps of the first and
* last samples as the total time passed, and the test may actually have
@@ -192,41 +168,6 @@
}
/**
- * Returns a String that represents the throughput associated for this
- * sampler, in units appropriate to its dimension:
- * <p>
- * The number is represented in requests/second or requests/minute or
- * requests/hour.
- * <p>
- * Examples: "34.2/sec" "0.1/sec" "43.0/hour" "15.9/min"
- *
- * @return a String representation of the rate the samples are being taken
- * at.
- */
- public String getRateString() {
- double rate = getRate();
-
- if (rate == Double.MAX_VALUE) {
- return "N/A";
- }
-
- String unit = "sec";
-
- if (rate < 1.0) {
- rate *= 60.0;
- unit = "min";
- }
- if (rate < 1.0) {
- rate *= 60.0;
- unit = "hour";
- }
-
- String rval = rateFormatter.format(rate) + "/" + unit;
-
- return (rval);
- }
-
- /**
* calculates the average page size, which means divide the bytes by number
* of samples.
*
@@ -240,16 +181,6 @@
}
/**
- * formats the rate
- *
- * @return
- */
- public String getPageSizeString() {
- double rate = getPageSize() / 1024;
- return kbFormatter.format(rate);
- }
-
- /**
* Throughput in bytes / second
*
* @return
@@ -262,12 +193,12 @@
}
/**
- * formats the Page Size
+ * Throughput in kilobytes / second
*
* @return
*/
- public String getKBPerSecondString() {
- double rate = getBytesPerSecond() / 1024;
- return kbFormatter.format(rate);
+ public double getKBPerSecond() {
+ return getBytesPerSecond() / 1024;
}
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org