jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milam...@apache.org
Subject svn commit: r1444399 - in /jmeter/trunk: docs/images/screenshots/ src/components/org/apache/jmeter/visualizers/ src/core/org/apache/jmeter/resources/ xdocs/ xdocs/images/screenshots/ xdocs/usermanual/
Date Sat, 09 Feb 2013 17:35:53 GMT
Author: milamber
Date: Sat Feb  9 17:35:52 2013
New Revision: 1444399

URL: http://svn.apache.org/r1444399
Log:
Improve Response Time Graph Y axis scale with huge values or small values (< 1000ms). Add
a new field to define increment scale
Bugzilla Id: 54532

Modified:
    jmeter/trunk/docs/images/screenshots/response_time_graph.png
    jmeter/trunk/docs/images/screenshots/response_time_graph_settings.png
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphChart.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/images/screenshots/response_time_graph.png
    jmeter/trunk/xdocs/images/screenshots/response_time_graph_settings.png
    jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jmeter/trunk/docs/images/screenshots/response_time_graph.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/images/screenshots/response_time_graph.png?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
Binary files - no diff available.

Modified: jmeter/trunk/docs/images/screenshots/response_time_graph_settings.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/docs/images/screenshots/response_time_graph_settings.png?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
Binary files - no diff available.

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphChart.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphChart.java?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphChart.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphChart.java Sat
Feb  9 17:35:52 2013
@@ -74,6 +74,8 @@ public class RespTimeGraphChart extends 
     
     protected int height;
 
+    protected int incrYAxisScale;
+
     protected String[] legendLabels = { JMeterUtils.getResString("aggregate_graph_legend")
}; // $NON-NLS-1$
 
     protected int maxYAxisScale;
@@ -151,6 +153,13 @@ public class RespTimeGraphChart extends 
     }
 
     /**
+     * @param incrYAxisScale the incrYAxisScale to set
+     */
+    public void setIncrYAxisScale(int incrYAxisScale) {
+        this.incrYAxisScale = incrYAxisScale;
+    }
+
+    /**
      * @return the maxYAxisScale
      */
     public int getMaxYAxisScale() {
@@ -264,10 +273,10 @@ public class RespTimeGraphChart extends 
 
     private void drawSample(String _title, String[] _xAxisLabels,
             String _yAxisTitle, String[] _legendLabels, 
-            double[][] _data, int _width, int _height, 
+            double[][] _data, int _width, int _height, int _incrScaleYAxis,
             Color[] _color, Font legendFont, Graphics g) {
         
-        double max = maxYAxisScale > 0 ? maxYAxisScale : findMax(_data); // define max
scale y axis
+        double max = maxYAxisScale > 0 ? maxYAxisScale : getTopValue(findMax(_data), BigDecimal.ROUND_UP);
// define max scale y axis
         try {
             // if the title graph is empty, we can assume some default
             if (_title.length() == 0 ) {
@@ -313,11 +322,17 @@ public class RespTimeGraphChart extends 
 
             // Y Axis ruler
             try {
-                BigDecimal round = new BigDecimal(max / 1000d);
-                round = round.setScale(0, BigDecimal.ROUND_UP);
-                double topValue = round.doubleValue() * 1000;
-                yaxis.setUserDefinedScale(0, 500);
-                yaxis.setNumItems((int) (topValue / 500)+1);
+                double numInterval = _height / 50; // ~a tic every 50 px
+                double incrYAxis = new Double(max / numInterval);
+                double incrTopValue = _incrScaleYAxis;
+                if (_incrScaleYAxis == 0) {
+                    incrTopValue = getTopValue(incrYAxis, BigDecimal.ROUND_HALF_UP);
+                }
+                if (incrTopValue < 1) { 
+                    incrTopValue = 1.0d; // Increment cannot be < 1
+                }
+                yaxis.setUserDefinedScale(0, incrTopValue);
+                yaxis.setNumItems(new Double(max / incrTopValue).intValue() + 1);
                 yaxis.setShowGridLines(1);
             } catch (PropertyException e) {
                 log.warn("",e);
@@ -350,13 +365,26 @@ public class RespTimeGraphChart extends 
         }
     }
 
+    private int getTopValue(double value, int roundMode) {
+        String maxStr = String.valueOf(Math.round(value));
+        String divValueStr = "1"; //$NON-NLS-1$
+        for (int i = 1; i < maxStr.length(); i++) {
+            divValueStr += "0"; //$NON-NLS-1$
+        }
+        int divValueInt = Integer.parseInt(divValueStr);
+        BigDecimal round = new BigDecimal(value / divValueInt);
+        round = round.setScale(0, roundMode);
+        int topValue = round.intValue() * divValueInt;
+        return topValue;
+    }
+
     @Override
     public void paintComponent(Graphics graphics) {
         if (data != null && this.title != null && this.xAxisLabels != null
&&
                 this.yAxisLabel != null && this.yAxisTitle != null) {
             drawSample(this.title, this.xAxisLabels, 
                     this.yAxisTitle, this.legendLabels,
-                    this.data, this.width, this.height, this.color,
+                    this.data, this.width, this.height, this.incrYAxisScale, this.color,
                     this.legendFont, graphics);
         }
     }

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=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
(original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
Sat Feb  9 17:35:52 2013
@@ -158,7 +158,7 @@ public class RespTimeGraphVisualizer ext
             new JLabeledTextField(JMeterUtils.getResString("graph_resp_time_xaxis_time_format"),
10); //$NON-NLS-1$ $NON-NLS-2$
 
     private final JLabeledTextField maxValueYAxisLabel =
-            new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_yaxis_max_value"),
8); //$NON-NLS-1$
+            new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_yaxis_max_value"),
5); //$NON-NLS-1$
 
     /**
      * checkbox for use dynamic graph size
@@ -170,6 +170,9 @@ public class RespTimeGraphVisualizer ext
     private final JLabeledTextField graphHeight =
             new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_height"), 6);
//$NON-NLS-1$
 
+    private final JLabeledTextField incrScaleYAxis =
+            new JLabeledTextField(JMeterUtils.getResString("aggregate_graph_increment_scale"),
5); //$NON-NLS-1$
+
     private long minStartTime = Long.MAX_VALUE;
 
     private long maxStartTime = Long.MIN_VALUE;
@@ -302,6 +305,7 @@ public class RespTimeGraphVisualizer ext
 
         graphPanel.setHeight(height);
         graphPanel.setWidth(width);
+        graphPanel.setIncrYAxisScale(getIncrScaleYAxis());
         // Draw the graph
         graphPanel.repaint();
     }
@@ -575,6 +579,15 @@ public class RespTimeGraphVisualizer ext
         return linesColors;
     }
 
+    private int getIncrScaleYAxis() {
+        int incrYAxisScale = 0;
+        String iyas = incrScaleYAxis.getText();
+        if (iyas.length() != 0) {
+            incrYAxisScale = Integer.parseInt(iyas);
+        }
+        return incrYAxisScale;
+    }
+
     private JPanel createGraphSettingsPane() {
         JPanel settingsPane = new JPanel(new BorderLayout());
         settingsPane.setBorder(BorderFactory.createTitledBorder(
@@ -713,7 +726,7 @@ public class RespTimeGraphVisualizer ext
                 BorderFactory.createEtchedBorder(),
                 JMeterUtils.getResString("aggregate_graph_yaxis_group"))); // $NON-NLS-1$
         yAxisPane.add(maxValueYAxisLabel);
-
+        yAxisPane.add(incrScaleYAxis);
         yAxisPane.add(numberShowGrouping);
         return yAxisPane;
     }

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sat Feb  9 17:35:52
2013
@@ -46,6 +46,7 @@ aggregate_graph_draw_outlines=Draw outli
 aggregate_graph_dynamic_size=Dynamic graph size
 aggregate_graph_font=Font\:
 aggregate_graph_height=Height\:
+aggregate_graph_increment_scale=Increment scale\:
 aggregate_graph_legend=Legend
 aggregate_graph_legend.placement.bottom=Bottom
 aggregate_graph_legend.placement.left=Left
@@ -73,7 +74,7 @@ aggregate_graph_value_font=Value font\:
 aggregate_graph_value_labels_vertical=Value labels vertical?
 aggregate_graph_width=Width\:
 aggregate_graph_xaxis_group=X Axis
-aggregate_graph_yaxis_group=Y Axis
+aggregate_graph_yaxis_group=Y Axis (milli-seconds)
 aggregate_graph_yaxis_max_value=Scale maximum value\:
 aggregate_report=Aggregate Report
 aggregate_report_90=90%

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sat Feb  9 17:35:52
2013
@@ -40,6 +40,7 @@ aggregate_graph_draw_outlines=Bordure de
 aggregate_graph_dynamic_size=Taille de graphique dynamique
 aggregate_graph_font=Police \:
 aggregate_graph_height=Hauteur \:
+aggregate_graph_increment_scale=Intervalle \u00E9chelle \:
 aggregate_graph_legend=L\u00E9gende
 aggregate_graph_legend.placement.bottom=Bas
 aggregate_graph_legend.placement.left=Gauche
@@ -67,7 +68,7 @@ aggregate_graph_value_font=Police de la 
 aggregate_graph_value_labels_vertical=Libell\u00E9 de valeurs vertical ?
 aggregate_graph_width=Largeur \:
 aggregate_graph_xaxis_group=Abscisses
-aggregate_graph_yaxis_group=Ordonn\u00E9es
+aggregate_graph_yaxis_group=Ordonn\u00E9es (milli-secondes)
 aggregate_graph_yaxis_max_value=Echelle maximum \:
 aggregate_report=Rapport agr\u00E9g\u00E9
 aggregate_report_90=90%

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Feb  9 17:35:52 2013
@@ -143,6 +143,7 @@ This does not affect JMeter operation.
 
 <h3>Listeners</h3>
 <ul>
+<li><bugzilla>54532</bugzilla> - Improve Response Time Graph Y axis scale
with huge values or small values (&lt; 1000ms). Add a new field to define increment scale</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>

Modified: jmeter/trunk/xdocs/images/screenshots/response_time_graph.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/screenshots/response_time_graph.png?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
Binary files - no diff available.

Modified: jmeter/trunk/xdocs/images/screenshots/response_time_graph_settings.png
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/screenshots/response_time_graph_settings.png?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
Binary files - no diff available.

Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1444399&r1=1444398&r2=1444399&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Feb  9 17:35:52 2013
@@ -2909,7 +2909,7 @@ the graph as a PNG file.</description>
 </properties>
 </component>
 
-<component name="Response Time Graph" index="&sect-num;.3.13"  width="869" height="620"
screenshot="response_time_graph.png">
+<component name="Response Time Graph" index="&sect-num;.3.13"  width="921" height="616"
screenshot="response_time_graph.png">
 <description>
 The Response Time Graph draws a line chart showing the evolution of response time during
the test, for each labelled request. 
 If many samples exist for the same timestamp, the mean value is displayed.
@@ -2917,7 +2917,7 @@ If many samples exist for the same times
 <div align="center">
 <p>
     The figure below shows an example of settings to draw this graph.
-<figure width="871" height="489" image="response_time_graph_settings.png">Response
time graph settings</figure>
+<figure width="919" height="481" image="response_time_graph_settings.png">Response
time graph settings</figure>
 </p>
 </div>
 <p><i>Please note: All this parameters <b>aren't</b> saved in JMeter
jmx script.</i></p>
@@ -2933,7 +2933,7 @@ If many samples exist for the same times
         Use Width and Height fields to define a custom size. The unit is pixel. </property>
         <property name="X Axis settings" required="No">Customize the date format of
 X axis label.
         The syntax is the Java <a href="http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat
API</a>.</property>
-        <property name="Y Axis settings" required="No">Define a custom maximum value
for Y Axis. Show or not the number grouping in Y Axis labels.</property>
+        <property name="Y Axis settings" required="No">Define a custom maximum value
for Y Axis in milli-seconds. Define the increment for the scale (in ms) Show or not the number
grouping in Y Axis labels.</property>
         <property name="Legend" required="Yes">Define the placement and font settings
for chart legend</property>
 </properties>
 </component>



Mime
View raw message