You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/02/15 02:04:12 UTC
svn commit: r377909 - in /jakarta/jmeter/branches/rel-2-1/src:
components/org/apache/jmeter/visualizers/ core/org/apache/jmeter/visualizers/
Author: sebb
Date: Tue Feb 14 17:04:12 2006
New Revision: 377909
URL: http://svn.apache.org/viewcvs?rev=377909&view=rev
Log:
Make Sample a read-only class
Modified:
jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/Graph.java
jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java
jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/SplineModel.java
jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/Sample.java
jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
Modified: jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/Graph.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/Graph.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/Graph.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/Graph.java Tue Feb 14 17:04:12 2006
@@ -161,7 +161,7 @@
public void updateGui(final Sample oneSample) {
long h = model.getPercentPoint((float) 0.90).longValue();
boolean repaint = false;
- if ((oneSample.count % 20 == 0 || oneSample.count < 20) && h > (graphMax * 1.2) || graphMax > (h * 1.2)) {
+ if ((oneSample.getCount() % 20 == 0 || oneSample.getCount() < 20) && h > (graphMax * 1.2) || graphMax > (h * 1.2)) {
graphMax = h;
repaint = true;
}
@@ -206,9 +206,9 @@
int height = getHeight();
log.debug("Drawing a sample at " + x);
if (wantData) {
- int data = (int) (oneSample.data * height / graphMax);
+ int data = (int) (oneSample.getData() * height / graphMax);
- if (oneSample.success) {
+ if (oneSample.isSuccess()) {
g.setColor(Color.black);
} else {
g.setColor(JMeterColor.YELLOW);
@@ -218,27 +218,27 @@
}
if (wantAverage) {
- int average = (int) (oneSample.average * height / graphMax);
+ int average = (int) (oneSample.getAverage() * height / graphMax);
g.setColor(Color.blue);
g.drawLine(x % width, height - average, x % width, (height - average - 1));
}
if (wantMedian) {
- int median = (int) (oneSample.median * height / graphMax);
+ int median = (int) (oneSample.getMedian() * height / graphMax);
g.setColor(JMeterColor.purple);
g.drawLine(x % width, height - median, x % width, (height - median - 1));
}
if (wantDeviation) {
- int deviation = (int) (oneSample.deviation * height / graphMax);
+ int deviation = (int) (oneSample.getDeviation() * height / graphMax);
g.setColor(Color.red);
g.drawLine(x % width, height - deviation, x % width, (height - deviation - 1));
}
if (wantThroughput) {
- int throughput = (int) (oneSample.throughput * height / throughputMax);
+ int throughput = (int) (oneSample.getThroughput() * height / throughputMax);
g.setColor(JMeterColor.dark_green);
g.drawLine(x % width, height - throughput, x % width, (height - throughput - 1));
Modified: jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java Tue Feb 14 17:04:12 2006
@@ -1,4 +1,3 @@
-// $Header$
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
@@ -53,7 +52,8 @@
* @version $Revision$ $Date$
*/
public class GraphVisualizer extends AbstractVisualizer implements ImageVisualizer, ItemListener, Clearable {
- SamplingStatCalculator model;
+
+ private SamplingStatCalculator model;
private JTextField maxYField = null;
@@ -61,7 +61,7 @@
private JTextField noSamplesField = null;
- String minute = JMeterUtils.getResString("minute");
+ private String minute = JMeterUtils.getResString("minute");
private Graph graph;
@@ -110,12 +110,12 @@
public synchronized void updateGui(Sample s) {
// We have received one more sample
graph.updateGui(s);
- noSamplesField.setText(Long.toString(s.count));
- dataField.setText(Long.toString(s.data));
- averageField.setText(Long.toString(s.average));
- deviationField.setText(Long.toString(s.deviation));
- throughputField.setText(Double.toString(60 * s.throughput) + "/" + minute);
- medianField.setText(Long.toString(s.median));
+ noSamplesField.setText(Long.toString(s.getCount()));
+ dataField.setText(Long.toString(s.getData()));
+ averageField.setText(Long.toString(s.getAverage()));
+ deviationField.setText(Long.toString(s.getDeviation()));
+ throughputField.setText(Double.toString(60 * s.getThroughput()) + "/" + minute);
+ medianField.setText(Long.toString(s.getMedian()));
updateYAxis();
}
Modified: jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/SplineModel.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/SplineModel.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/SplineModel.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/SplineModel.java Tue Feb 14 17:04:12 2006
@@ -93,11 +93,11 @@
}
public long getCurrent() {
- return samples.getCurrentSample().data;
+ return samples.getCurrentSample().getData();
}
public long getSample(int i) {
- return samples.getSample(i).data;
+ return samples.getSample(i).getData();
}
public long getNumberOfCollectedSamples() {
@@ -135,7 +135,7 @@
for (int i = 0; i < numberOfNodes; i++) {
for (int j = 0; j < loadFactor; j++) {
- floatNode[i] += samples.getSample((int) ((i * loadFactor) + j)).data;
+ floatNode[i] += samples.getSample((int) ((i * loadFactor) + j)).getData();
}
floatNode[i] = floatNode[i] / loadFactor;
}
Modified: jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Tue Feb 14 17:04:12 2006
@@ -1,4 +1,3 @@
-// $Header$
/*
* Copyright 2005 The Apache Software Foundation.
*
@@ -71,7 +70,8 @@
*/
public class StatGraphVisualizer extends AbstractVisualizer implements Clearable,
ActionListener {
- transient private static Logger log = LoggingManager.getLoggerForClass();
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
private final String[] COLUMNS = { JMeterUtils.getResString("URL"),
JMeterUtils.getResString("aggregate_report_count"), JMeterUtils.getResString("average"),
JMeterUtils.getResString("aggregate_report_median"), JMeterUtils.getResString("aggregate_report_90%_line"),
@@ -106,7 +106,7 @@
protected JLabeledChoice columns =
new JLabeledChoice(JMeterUtils.getResString("aggregate_graph_column"),GRAPH_COLUMNS);
- protected double[][] data = null;
+ //NOT USED protected double[][] data = null;
protected JButton displayButton =
new JButton(JMeterUtils.getResString("aggregate_graph_display"));
Modified: jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/TableVisualizer.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/TableVisualizer.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/components/org/apache/jmeter/visualizers/TableVisualizer.java Tue Feb 14 17:04:12 2006
@@ -103,8 +103,7 @@
synchronized (calc) {
calc.addValue(res.getTime());
Sample newS = new Sample(res.getSampleLabel(), res.getTime(), 0, 0, 0, 0, 0, 0, res.isSuccessful(), calc
- .getCount(), res.getTimeStamp());
- newS.setBytes(res.getResponseData().length);
+ .getCount(), res.getTimeStamp(),res.getResponseData().length);
model.addRow(newS);
}
currentData = res.getTime();
Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/Sample.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/Sample.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/Sample.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/Sample.java Tue Feb 14 17:04:12 2006
@@ -1,4 +1,3 @@
-// $Header$
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
@@ -26,29 +25,29 @@
*/
public class Sample implements Serializable, Comparable {
- public long data;
+ private final long data;
- public long average;
+ private final long average;
- public long median;
+ private final long median;
- public long distributionLine;
+ private final long distributionLine;
- public long deviation;
+ private final long deviation;
- public double throughput;
+ private final double throughput;
- public long errorCount;
+ private final long errorCount;
- public boolean success = true;
+ private final boolean success;
- public String label = null;
+ private final String label;
- public long count;
+ private final long count;
- public long endTime;
+ private final long endTime;
- public int bytes = 0;
+ private final int bytes;
/**
* Constructor for the Sample object
@@ -81,18 +80,37 @@
this.errorCount = errorCount;
this.count = num;
this.endTime = endTime;
+ this.bytes = 0;
}
+ public Sample(String name, long data, long average, long deviation, long median, long distributionLine,
+ double throughput, long errorCount, boolean success, long num, long endTime, int bytes) {
+ this.data = data;
+ this.average = average;
+ this.deviation = deviation;
+ this.throughput = throughput;
+ this.success = success;
+ this.median = median;
+ this.distributionLine = distributionLine;
+ this.label = name;
+ this.errorCount = errorCount;
+ this.count = num;
+ this.endTime = endTime;
+ this.bytes = bytes;
+ }
+
public Sample() {
+ this(null, 0, 0, 0, 0, 0, 0, 0, true, 0, 0);
}
+ // Appears not to be used - however it is invoked via the Functor class
public int getBytes() {
return bytes;
}
- public void setBytes(int size) {
- bytes = size;
- }
+// public void setBytes(int size) {
+// bytes = size;
+// }
/**
* @return Returns the average.
@@ -101,13 +119,13 @@
return average;
}
- /**
- * @param average
- * The average to set.
- */
- public void setAverage(long average) {
- this.average = average;
- }
+// /**
+// * @param average
+// * The average to set.
+// */
+// public void setAverage(long average) {
+// this.average = average;
+// }
/**
* @return Returns the count.
@@ -116,13 +134,13 @@
return count;
}
- /**
- * @param count
- * The count to set.
- */
- public void setCount(long count) {
- this.count = count;
- }
+// /**
+// * @param count
+// * The count to set.
+// */
+// public void setCount(long count) {
+// this.count = count;
+// }
/**
* @return Returns the data.
@@ -131,13 +149,13 @@
return data;
}
- /**
- * @param data
- * The data to set.
- */
- public void setData(long data) {
- this.data = data;
- }
+// /**
+// * @param data
+// * The data to set.
+// */
+// public void setData(long data) {
+// this.data = data;
+// }
/**
* @return Returns the deviation.
@@ -146,13 +164,13 @@
return deviation;
}
- /**
- * @param deviation
- * The deviation to set.
- */
- public void setDeviation(long deviation) {
- this.deviation = deviation;
- }
+// /**
+// * @param deviation
+// * The deviation to set.
+// */
+// public void setDeviation(long deviation) {
+// this.deviation = deviation;
+// }
/**
* @return Returns the distributionLine.
@@ -161,13 +179,13 @@
return distributionLine;
}
- /**
- * @param distributionLine
- * The distributionLine to set.
- */
- public void setDistributionLine(long distributionLine) {
- this.distributionLine = distributionLine;
- }
+// /**
+// * @param distributionLine
+// * The distributionLine to set.
+// */
+// public void setDistributionLine(long distributionLine) {
+// this.distributionLine = distributionLine;
+// }
/**
* @return Returns the error.
@@ -176,13 +194,13 @@
return success;
}
- /**
- * @param error
- * The error to set.
- */
- public void setSuccess(boolean success) {
- this.success = success;
- }
+// /**
+// * @param error
+// * The error to set.
+// */
+// public void setSuccess(boolean success) {
+// this.success = success;
+// }
/**
* @return Returns the errorRate.
@@ -191,13 +209,13 @@
return errorCount;
}
- /**
- * @param errorRate
- * The errorRate to set.
- */
- public void setErrorCount(long errorCount) {
- this.errorCount = errorCount;
- }
+// /**
+// * @param errorRate
+// * The errorRate to set.
+// */
+// public void setErrorCount(long errorCount) {
+// this.errorCount = errorCount;
+// }
/**
* @return Returns the label.
@@ -206,13 +224,13 @@
return label;
}
- /**
- * @param label
- * The label to set.
- */
- public void setLabel(String label) {
- this.label = label;
- }
+// /**
+// * @param label
+// * The label to set.
+// */
+// public void setLabel(String label) {
+// this.label = label;
+// }
/**
* @return Returns the median.
@@ -221,13 +239,13 @@
return median;
}
- /**
- * @param median
- * The median to set.
- */
- public void setMedian(long median) {
- this.median = median;
- }
+// /**
+// * @param median
+// * The median to set.
+// */
+// public void setMedian(long median) {
+// this.median = median;
+// }
/**
* @return Returns the throughput.
@@ -236,13 +254,13 @@
return throughput;
}
- /**
- * @param throughput
- * The throughput to set.
- */
- public void setThroughput(double throughput) {
- this.throughput = throughput;
- }
+// /**
+// * @param throughput
+// * The throughput to set.
+// */
+// public void setThroughput(double throughput) {
+// this.throughput = throughput;
+// }
/*
* (non-Javadoc)
@@ -261,11 +279,11 @@
return endTime;
}
- /**
- * @param endTime
- * The endTime to set.
- */
- public void setEndTime(long endTime) {
- this.endTime = endTime;
- }
+// /**
+// * @param endTime
+// * The endTime to set.
+// */
+// public void setEndTime(long endTime) {
+// this.endTime = endTime;
+// }
}
Modified: jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java?rev=377909&r1=377908&r2=377909&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/core/org/apache/jmeter/visualizers/SamplingStatCalculator.java Tue Feb 14 17:04:12 2006
@@ -124,9 +124,9 @@
* @return how long the samples took
*/
public long getElapsed() {
- if (getCurrentSample().endTime == 0)
+ if (getCurrentSample().getEndTime() == 0)
return 0;// No samples collected ...
- return getCurrentSample().endTime - firstTime;
+ return getCurrentSample().getEndTime() - firstTime;
}
/**
@@ -139,7 +139,7 @@
if (calculator.getCount() == 0)
return 0.0; // Better behaviour when howLong=0 or lastTime=0
- return getCurrentSample().throughput;
+ return getCurrentSample().getThroughput();
}
/**
@@ -239,7 +239,7 @@
calculator.addBytes(byteslength);
}
setStartTime(res);
- eCount = getCurrentSample().errorCount;
+ eCount = getCurrentSample().getErrorCount();
if (!res.isSuccessful()) {
eCount++;
}
@@ -282,7 +282,7 @@
private long getEndTime(SampleResult res) {
long endTime = res.getTimeStamp();
- long lastTime = getCurrentSample().endTime;
+ long lastTime = getCurrentSample().getEndTime();
if (res.isStampedAtStart()) {
endTime += res.getTime();
}
@@ -320,7 +320,7 @@
if (calculator.getCount() == 0) {
return (rval);
}
- rval = (double) getCurrentSample().errorCount / (double) calculator.getCount();
+ rval = (double) getCurrentSample().getErrorCount() / (double) calculator.getCount();
return (rval);
}
@@ -359,7 +359,7 @@
* @return errorCount
*/
public long getErrorCount() {
- return getCurrentSample().errorCount;
+ return getCurrentSample().getErrorCount();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org