You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2012/08/21 16:42:26 UTC
svn commit: r1375581 -
/jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
Author: pmouawad
Date: Tue Aug 21 14:42:25 2012
New Revision: 1375581
URL: http://svn.apache.org/viewvc?rev=1375581&view=rev
Log:
UPPER case for static
little optimisation in map gets (replace containsKey+get by get then null test)
Little optimisation on Map copy (use iterator instead of key iterator + get per key)
Modified:
jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
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=1375581&r1=1375580&r2=1375581&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java Tue Aug 21 14:42:25 2012
@@ -37,7 +37,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -89,9 +88,9 @@ public class RespTimeGraphVisualizer ext
*/
private final transient Object lockInterval = new Object();
- private static final String yAxisLabel = JMeterUtils.getResString("aggregate_graph_response_time");//$NON-NLS-1$
+ private static final String Y_AXIS_LABEL = JMeterUtils.getResString("aggregate_graph_response_time");//$NON-NLS-1$
- private static final String yAxisTitle = JMeterUtils.getResString("aggregate_graph_ms"); //$NON-NLS-1$
+ private static final String Y_AXIS_TITLE = JMeterUtils.getResString("aggregate_graph_ms"); //$NON-NLS-1$
private RespTimeGraphChart graphPanel = null;
@@ -229,8 +228,8 @@ public class RespTimeGraphVisualizer ext
}
}
// List of value by sampler
- if (pList.containsKey(sampleLabel)) {
- Map<Integer, Long> subList = pList.get(sampleLabel);
+ Map<Integer, Long> subList = pList.get(sampleLabel);
+ if (subList != null) {
long respTime = sampleResult.getTime();
Long value = subList.get(startTimeInterval);
if (value!=null) {
@@ -271,8 +270,8 @@ public class RespTimeGraphVisualizer ext
graphPanel.setTitle(graphTitle.getText());
graphPanel.setMaxYAxisScale(maxYAxisScale);
- graphPanel.setYAxisLabels(this.yAxisLabel);
- graphPanel.setYAxisTitle(this.yAxisTitle);
+ graphPanel.setYAxisLabels(Y_AXIS_LABEL);
+ graphPanel.setYAxisTitle(Y_AXIS_TITLE);
graphPanel.setXAxisLabels(getXAxisLabels());
graphPanel.setLegendLabels(getLegendLabels());
graphPanel.setColor(getLinesColors());
@@ -308,10 +307,9 @@ public class RespTimeGraphVisualizer ext
double nanLast = 0;
double nanBegin = 0;
List<Double> nanList = new ArrayList<Double>();
- Set<String> pointsKeys = pList.keySet();
int s = 0;
- for (String pointKey : pointsKeys) {
- Map<Integer, Long> subList = pList.get(pointKey);
+ for (Map.Entry<String, Map<Integer, Long>> pointEntry : pList.entrySet()) {
+ Map<Integer, Long> subList = pointEntry.getValue();
int idx = 0;
while (idx < durationTest) {
@@ -442,8 +440,8 @@ public class RespTimeGraphVisualizer ext
private String[] getLegendLabels() {
String[] legends = new String[seriesNames.size()];
int i = 0;
- for (String key : seriesNames.keySet()) {
- RespTimeGraphLineBean val = seriesNames.get(key);
+ for (Map.Entry<String, RespTimeGraphLineBean> entry : seriesNames.entrySet()) {
+ RespTimeGraphLineBean val = entry.getValue();
legends[i] = val.getLabel();
i++;
}
@@ -453,8 +451,8 @@ public class RespTimeGraphVisualizer ext
private Color[] getLinesColors() {
Color[] linesColors = new Color[seriesNames.size()];
int i = 0;
- for (String key : seriesNames.keySet()) {
- RespTimeGraphLineBean val = seriesNames.get(key);
+ for (Map.Entry<String, RespTimeGraphLineBean> entry : seriesNames.entrySet()) {
+ RespTimeGraphLineBean val = entry.getValue();
linesColors[i] = val.getLineColor();
i++;
}