jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1435860 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java xdocs/changes.xml
Date Sun, 20 Jan 2013 14:59:13 GMT
Author: pmouawad
Date: Sun Jan 20 14:59:12 2013
New Revision: 1435860

URL: http://svn.apache.org/viewvc?rev=1435860&view=rev
Log:
Bug 54451 - Response Time Graph reports wrong times when the are many samples for same time

Also fixed OOM in getData() introduced by 54287 (reset of values was not impacted to use Long.MAX_VALUE
and Long.MIN_VALUE)
Bugzilla Id: 54451

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java?rev=1435860&r1=1435859&r2=1435860&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
Sun Jan 20 14:59:12 2013
@@ -69,6 +69,7 @@ import org.apache.jmeter.visualizers.uti
 import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.JLabeledTextField;
 import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.math.StatCalculatorLong;
 import org.apache.log.Logger;
 
 public class RespTimeGraphVisualizer extends AbstractVisualizer implements ActionListener,
Clearable {
@@ -181,7 +182,7 @@ public class RespTimeGraphVisualizer ext
     /**
      * We want to retain insertion order, so LinkedHashMap is necessary
      */
-    private final Map<String, Map<Long, Long>> pList = new LinkedHashMap<String,
Map<Long, Long>>();
+    private final Map<String, Map<Long, StatCalculatorLong>> pList = new LinkedHashMap<String,
Map<Long, StatCalculatorLong>>();
 
     private long durationTest = 0;
     
@@ -234,19 +235,22 @@ public class RespTimeGraphVisualizer ext
                             }
                         }
                         // List of value by sampler
-                        Map<Long, Long> subList = pList.get(sampleLabel);
+                        Map<Long, StatCalculatorLong> subList = pList.get(sampleLabel);
                         final Long startTimeIntervalLong = Long.valueOf(startTimeInterval);
                         if (subList != null) {
                             long respTime = sampleResult.getTime();
-                            Long value = subList.get(startTimeIntervalLong);
-                            if (value!=null) {
-                                respTime = (value.longValue() + respTime) / 2;
+                            StatCalculatorLong value = subList.get(startTimeIntervalLong);
+                            if (value==null) {
+                                value = new StatCalculatorLong();
+                                subList.put(startTimeIntervalLong, value);
                             }
-                            subList.put(startTimeIntervalLong, Long.valueOf(respTime));
+                            value.addValue(respTime, 1);
                         } else {
                             // We want to retain insertion order, so LinkedHashMap is necessary
-                            Map<Long, Long> newSubList = new LinkedHashMap<Long,
Long>();
-                            newSubList.put(startTimeIntervalLong, Long.valueOf(sampleResult.getTime()));
+                            Map<Long, StatCalculatorLong> newSubList = new LinkedHashMap<Long,
StatCalculatorLong>(5);
+                            StatCalculatorLong helper = new StatCalculatorLong();
+                            helper.addValue(Long.valueOf(sampleResult.getTime()),1);
+                            newSubList.put(startTimeIntervalLong,  helper);
                             pList.put(sampleLabel, newSubList);
                         }
                     }
@@ -316,13 +320,13 @@ public class RespTimeGraphVisualizer ext
         double nanBegin = 0;
         List<Double> nanList = new ArrayList<Double>();
         int s = 0;
-        for (Map<Long, Long> subList : pList.values()) {
+        for (Map<Long, StatCalculatorLong> subList : pList.values()) {
             int idx = 0;
             while (idx < durationTest) {
                 long keyShift = minStartTime + idx;
-                Long value = subList.get(Long.valueOf(keyShift));
+                StatCalculatorLong value = subList.get(Long.valueOf(keyShift));
                 if (value != null) {
-                    nanLast = value.doubleValue();
+                    nanLast = value.getMean();
                     data[s][idx] = nanLast;
                     // Calculate intermediate values (if needed)
                     int nlsize = nanList.size();
@@ -360,8 +364,8 @@ public class RespTimeGraphVisualizer ext
             internalList.clear();
             seriesNames.clear();
             pList.clear();
-            minStartTime = Integer.MAX_VALUE;
-            maxStartTime = Integer.MIN_VALUE;
+            minStartTime = Long.MAX_VALUE;
+            maxStartTime = Long.MIN_VALUE;
             durationTest = 0;
             colorIdx = 0;
         }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1435860&r1=1435859&r2=1435860&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Jan 20 14:59:12 2013
@@ -171,6 +171,7 @@ and right angle bracket (&gt;) in search
 <li><bugzilla>54088</bugzilla> - The type video/f4m is text, not binary</li>
 <li><bugzilla>54166</bugzilla> - ViewResultsTree could not render the HTML
response: handle failure to parse HTML</li>
 <li><bugzilla>54287</bugzilla> - Incorrect Timestamp in Response Time Graph
when using a date with time in Date format field</li>
+<li><bugzilla>54451</bugzilla> - Response Time Graph reports wrong times
when the are many samples for same time</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>



Mime
View raw message