Author: sebb
Date: Thu Oct 21 13:19:52 2010
New Revision: 1025989

URL: http://svn.apache.org/viewvc?rev=1025989&view=rev
Log:
Bug 50088 - fix getAvgPageBytes in SamplingStatCalculator so it returns what it 
should

Modified:
    
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java?rev=1025989&r1=1025988&r2=1025989&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
 (original)
+++ 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
 Thu Oct 21 13:19:52 2010
@@ -124,17 +124,14 @@ public class SamplingStatCalculator {
      * calculates the average page size, which means divide the bytes by number
      * of samples.
      *
-     * @return average page size in bytes
+     * @return average page size in bytes (0 if sample count is zero)
      */
     public double getAvgPageBytes() {
-        double rate = 0;
-        if (this.getElapsed() > 0 && calculator.getTotalBytes() > 0) {
-            rate = calculator.getTotalBytes() / ((double) this.getElapsed() / 
1000);
-        }
-        if (rate < 0) {
-            rate = 0;
+        int count = calculator.getCount();
+        if (count == 0) {
+            return 0;
         }
-        return rate;
+        return calculator.getTotalBytes() / count;
     }
 
     public String getLabel() {

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1025989&r1=1025988&r2=1025989&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Oct 21 13:19:52 2010
@@ -100,6 +100,7 @@ To override the default local language f
 <li>Bug 49734 - Null pointer exception on stop Threads command (Run>Stop)</li>
 <li>Bug 49666 - CSV Header read as data after EOF</li>
 <li>Bug 45703 - Synchronizing Timer</li>
+<li>Bug 50088 - fix getAvgPageBytes in SamplingStatCalculator so it returns 
what it should</li>
 </ul>
 
 <!-- ==================================================== -->



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to