jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1782515 - in /jmeter/trunk: bin/jmeter.properties src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java xdocs/usermanual/properties_reference.xml
Date Fri, 10 Feb 2017 20:04:58 GMT
Author: fschumacher
Date: Fri Feb 10 20:04:58 2017
New Revision: 1782515

URL: http://svn.apache.org/viewvc?rev=1782515&view=rev
Log:
Simplify code and implement the option to keep all results in the view (even if it will consume
a lot of memory).

Bugzilla Id: 60687

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
    jmeter/trunk/xdocs/usermanual/properties_reference.xml

Modified: jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1782515&r1=1782514&r2=1782515&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Fri Feb 10 20:04:58 2017
@@ -1080,6 +1080,7 @@ view.results.tree.renderers_order=.Rende
 #view.results.tree.update_period=500
 
 # Maximum number of results in the results tree
+# Set to 0 to store all results (might consume a lot of memory)
 #view.results.tree.max_results=500
 
 # Maximum size of Document that can be parsed by Tika engine; defaut=10 * 1024 * 1024 (10MB)

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java?rev=1782515&r1=1782514&r2=1782515&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
Fri Feb 10 20:04:58 2017
@@ -57,7 +57,9 @@ import javax.swing.tree.DefaultTreeModel
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
-import org.apache.commons.collections.buffer.BoundedFifoBuffer;
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.collections.buffer.CircularFifoBuffer;
+import org.apache.commons.collections.buffer.UnboundedFifoBuffer;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.jmeter.JMeter;
 import org.apache.jmeter.assertions.AssertionResult;
@@ -135,7 +137,7 @@ implements ActionListener, TreeSelection
 
     private JCheckBox autoScrollCB;
 
-    private BoundedFifoBuffer buffer = new BoundedFifoBuffer(JMeterUtils.getPropDefault("view.results.tree.max_results",
500));
+    private Buffer buffer;
 
     private boolean dataChanged;
 
@@ -144,19 +146,20 @@ implements ActionListener, TreeSelection
      */
     public ViewResultsFullVisualizer() {
         super();
+        final int maxResults = JMeterUtils.getPropDefault("view.results.tree.max_results",
500);
+        if (maxResults > 0) {
+            buffer = new CircularFifoBuffer(maxResults);
+        } else {
+            buffer = new UnboundedFifoBuffer();
+        }
         init();
-        new Timer(REFRESH_PERIOD, e -> {
-            updateGui();
-        }).start();
+        new Timer(REFRESH_PERIOD, e -> updateGui()).start();
     }
 
     /** {@inheritDoc} */
     @Override
     public void add(final SampleResult sample) {
         synchronized (buffer) {
-            if (buffer.isFull()) {
-                buffer.remove();
-            }
             buffer.add(sample);
             dataChanged = true;
         }
@@ -171,10 +174,8 @@ implements ActionListener, TreeSelection
                 return;
             }
             root.removeAllChildren();
-            @SuppressWarnings("unchecked")
-            Iterator<SampleResult> samplers = buffer.iterator();
-            while (samplers.hasNext()) {
-                SampleResult res = (SampleResult) samplers.next();
+            for (Object sampler: buffer) {
+                SampleResult res = (SampleResult) sampler;
                 // Add sample
                 DefaultMutableTreeNode currNode = new SearchableTreeNode(res, treeModel);
                 treeModel.insertNodeInto(currNode, root, root.getChildCount());

Modified: jmeter/trunk/xdocs/usermanual/properties_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/properties_reference.xml?rev=1782515&r1=1782514&r2=1782515&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/properties_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/properties_reference.xml Fri Feb 10 20:04:58 2017
@@ -1457,6 +1457,7 @@ log_level.org.apache.http.client=DEBUG
 </property>
 <property name="view.results.tree.max_results">
     Maximum number of main samples, that should be stored and displayed.<br/>
+    A value of <code>0</code> will store all results. This might consume a lot
of memory.<br/>
     Defaults to: <code>500</code>
 </property>
 <property name="view.results.tree.max_size">



Mime
View raw message