Lines 28-33
Link Here
|
28 |
import java.io.FileNotFoundException; |
28 |
import java.io.FileNotFoundException; |
29 |
import java.io.FileWriter; |
29 |
import java.io.FileWriter; |
30 |
import java.io.IOException; |
30 |
import java.io.IOException; |
|
|
31 |
import java.text.MessageFormat; |
31 |
import java.util.ArrayList; |
32 |
import java.util.ArrayList; |
32 |
import java.util.List; |
33 |
import java.util.List; |
33 |
import java.util.Map; |
34 |
import java.util.Map; |
Lines 65-70
Link Here
|
65 |
import org.apache.jmeter.gui.action.SaveGraphics; |
66 |
import org.apache.jmeter.gui.action.SaveGraphics; |
66 |
import org.apache.jmeter.gui.util.FileDialoger; |
67 |
import org.apache.jmeter.gui.util.FileDialoger; |
67 |
import org.apache.jmeter.gui.util.FilePanel; |
68 |
import org.apache.jmeter.gui.util.FilePanel; |
|
|
69 |
import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer; |
68 |
import org.apache.jmeter.gui.util.VerticalPanel; |
70 |
import org.apache.jmeter.gui.util.VerticalPanel; |
69 |
import org.apache.jmeter.samplers.Clearable; |
71 |
import org.apache.jmeter.samplers.Clearable; |
70 |
import org.apache.jmeter.samplers.SampleResult; |
72 |
import org.apache.jmeter.samplers.SampleResult; |
Lines 92-115
Link Here
|
92 |
public class StatGraphVisualizer extends AbstractVisualizer implements Clearable, ActionListener { |
94 |
public class StatGraphVisualizer extends AbstractVisualizer implements Clearable, ActionListener { |
93 |
private static final long serialVersionUID = 240L; |
95 |
private static final long serialVersionUID = 240L; |
94 |
|
96 |
|
|
|
97 |
private static final String pct1Label = JMeterUtils.getPropDefault("aggregate_rpt_pct1", "90"); |
98 |
private static final String pct2Label = JMeterUtils.getPropDefault("aggregate_rpt_pct2", "95"); |
99 |
private static final String pct3Label = JMeterUtils.getPropDefault("aggregate_rpt_pct3", "99"); |
100 |
|
101 |
private static final Float pct1Value = new Float(Float.parseFloat(pct1Label)/100); |
102 |
private static final Float pct2Value = new Float(Float.parseFloat(pct2Label)/100); |
103 |
private static final Float pct3Value = new Float(Float.parseFloat(pct3Label)/100); |
104 |
|
95 |
private static final Logger log = LoggingManager.getLoggerForClass(); |
105 |
private static final Logger log = LoggingManager.getLoggerForClass(); |
96 |
|
106 |
|
97 |
private final String[] COLUMNS = { JMeterUtils.getResString("sampler_label"), //$NON-NLS-1$ |
107 |
static final String[] COLUMNS = { |
98 |
JMeterUtils.getResString("aggregate_report_count"), //$NON-NLS-1$ |
108 |
"sampler_label", //$NON-NLS-1$ |
99 |
JMeterUtils.getResString("average"), //$NON-NLS-1$ |
109 |
"aggregate_report_count", //$NON-NLS-1$ |
100 |
JMeterUtils.getResString("aggregate_report_median"), //$NON-NLS-1$ |
110 |
"average", //$NON-NLS-1$ |
101 |
JMeterUtils.getResString("aggregate_report_90%_line"), //$NON-NLS-1$ |
111 |
"aggregate_report_median", //$NON-NLS-1$ |
102 |
JMeterUtils.getResString("aggregate_report_min"), //$NON-NLS-1$ |
112 |
"aggregate_report_xx_pct1_line", //$NON-NLS-1$ |
103 |
JMeterUtils.getResString("aggregate_report_max"), //$NON-NLS-1$ |
113 |
"aggregate_report_xx_pct2_line", //$NON-NLS-1$ |
104 |
JMeterUtils.getResString("aggregate_report_error%"), //$NON-NLS-1$ |
114 |
"aggregate_report_xx_pct3_line", //$NON-NLS-1$ |
105 |
JMeterUtils.getResString("aggregate_report_rate"), //$NON-NLS-1$ |
115 |
"aggregate_report_min", //$NON-NLS-1$ |
106 |
JMeterUtils.getResString("aggregate_report_bandwidth") }; //$NON-NLS-1$ |
116 |
"aggregate_report_max", //$NON-NLS-1$ |
|
|
117 |
"aggregate_report_error%", //$NON-NLS-1$ |
118 |
"aggregate_report_rate", //$NON-NLS-1$ |
119 |
"aggregate_report_bandwidth" }; //$NON-NLS-1$ |
120 |
|
121 |
static final Object[][] COLUMNS_MSG_PARAMETERS = { null, //$NON-NLS-1$ |
122 |
null, //$NON-NLS-1$ |
123 |
null, //$NON-NLS-1$ |
124 |
null, //$NON-NLS-1$ |
125 |
new Object[]{pct1Label}, //$NON-NLS-1$ |
126 |
new Object[]{pct2Label}, //$NON-NLS-1$ |
127 |
new Object[]{pct3Label}, //$NON-NLS-1$ |
128 |
null, //$NON-NLS-1$ |
129 |
null, //$NON-NLS-1$ |
130 |
null, //$NON-NLS-1$ |
131 |
null, //$NON-NLS-1$ |
132 |
null }; //$NON-NLS-1$ |
107 |
|
133 |
|
108 |
private final String[] GRAPH_COLUMNS = {JMeterUtils.getResString("average"),//$NON-NLS-1$ |
134 |
private final String[] GRAPH_COLUMNS = {"average",//$NON-NLS-1$ |
109 |
JMeterUtils.getResString("aggregate_report_median"), //$NON-NLS-1$ |
135 |
"aggregate_report_median", //$NON-NLS-1$ |
110 |
JMeterUtils.getResString("aggregate_report_90%_line"), //$NON-NLS-1$ |
136 |
"aggregate_report_xx_pct1_line", //$NON-NLS-1$ |
111 |
JMeterUtils.getResString("aggregate_report_min"), //$NON-NLS-1$ |
137 |
"aggregate_report_xx_pct2_line", //$NON-NLS-1$ |
112 |
JMeterUtils.getResString("aggregate_report_max")}; //$NON-NLS-1$ |
138 |
"aggregate_report_xx_pct3_line", //$NON-NLS-1$ |
|
|
139 |
"aggregate_report_min", //$NON-NLS-1$ |
140 |
"aggregate_report_max"}; //$NON-NLS-1$ |
113 |
|
141 |
|
114 |
private final String TOTAL_ROW_LABEL = |
142 |
private final String TOTAL_ROW_LABEL = |
115 |
JMeterUtils.getResString("aggregate_report_total_label"); //$NON-NLS-1$ |
143 |
JMeterUtils.getResString("aggregate_report_total_label"); //$NON-NLS-1$ |
Lines 239-245
Link Here
|
239 |
|
267 |
|
240 |
public StatGraphVisualizer() { |
268 |
public StatGraphVisualizer() { |
241 |
super(); |
269 |
super(); |
242 |
model = new ObjectTableModel(COLUMNS, |
270 |
model = createObjectTableModel(); |
|
|
271 |
eltList.add(new BarGraph(JMeterUtils.getResString("average"), true, new Color(202, 0, 0))); |
272 |
eltList.add(new BarGraph(JMeterUtils.getResString("aggregate_report_median"), false, new Color(49, 49, 181))); |
273 |
eltList.add(new BarGraph(MessageFormat.format(JMeterUtils.getResString("aggregate_report_xx_pct1_line"),new Object[]{pct1Label}), false, new Color(42, 121, 42))); |
274 |
eltList.add(new BarGraph(MessageFormat.format(JMeterUtils.getResString("aggregate_report_xx_pct2_line"),new Object[]{pct2Label}), false, new Color(242, 226, 8))); |
275 |
eltList.add(new BarGraph(MessageFormat.format(JMeterUtils.getResString("aggregate_report_xx_pct3_line"),new Object[]{pct3Label}), false, new Color(202, 10 , 232))); |
276 |
eltList.add(new BarGraph(JMeterUtils.getResString("aggregate_report_min"), false, Color.LIGHT_GRAY)); |
277 |
eltList.add(new BarGraph(JMeterUtils.getResString("aggregate_report_max"), false, Color.DARK_GRAY)); |
278 |
clearData(); |
279 |
init(); |
280 |
} |
281 |
|
282 |
/** |
283 |
* Creates that Table model |
284 |
* @return ObjectTableModel |
285 |
*/ |
286 |
static ObjectTableModel createObjectTableModel() { |
287 |
return new ObjectTableModel(COLUMNS, |
243 |
SamplingStatCalculator.class, |
288 |
SamplingStatCalculator.class, |
244 |
new Functor[] { |
289 |
new Functor[] { |
245 |
new Functor("getLabel"), //$NON-NLS-1$ |
290 |
new Functor("getLabel"), //$NON-NLS-1$ |
Lines 247-283
Link Here
|
247 |
new Functor("getMeanAsNumber"), //$NON-NLS-1$ |
292 |
new Functor("getMeanAsNumber"), //$NON-NLS-1$ |
248 |
new Functor("getMedian"), //$NON-NLS-1$ |
293 |
new Functor("getMedian"), //$NON-NLS-1$ |
249 |
new Functor("getPercentPoint", //$NON-NLS-1$ |
294 |
new Functor("getPercentPoint", //$NON-NLS-1$ |
250 |
new Object[] { new Float(.900) }), |
295 |
new Object[] { pct1Value }), |
|
|
296 |
new Functor("getPercentPoint", //$NON-NLS-1$ |
297 |
new Object[] { pct2Value }), |
298 |
new Functor("getPercentPoint", //$NON-NLS-1$ |
299 |
new Object[] { pct3Value }), |
251 |
new Functor("getMin"), //$NON-NLS-1$ |
300 |
new Functor("getMin"), //$NON-NLS-1$ |
252 |
new Functor("getMax"), //$NON-NLS-1$ |
301 |
new Functor("getMax"), //$NON-NLS-1$ |
253 |
new Functor("getErrorPercentage"), //$NON-NLS-1$ |
302 |
new Functor("getErrorPercentage"), //$NON-NLS-1$ |
254 |
new Functor("getRate"), //$NON-NLS-1$ |
303 |
new Functor("getRate"), //$NON-NLS-1$ |
255 |
new Functor("getKBPerSecond") }, //$NON-NLS-1$ |
304 |
new Functor("getKBPerSecond") }, //$NON-NLS-1$ |
256 |
new Functor[] { null, null, null, null, null, null, null, null, null, null }, |
305 |
new Functor[] { null, null, null, null, null, null, null, null, null, null, null, null }, |
257 |
new Class[] { String.class, Long.class, Long.class, Long.class, Long.class, Long.class, |
306 |
new Class[] { String.class, Long.class, Long.class, Long.class, Long.class, |
258 |
Long.class, String.class, String.class, String.class }); |
307 |
Long.class, Long.class, Long.class, Long.class, String.class, |
259 |
eltList.add(new BarGraph("average", true, new Color(202, 0, 0))); |
308 |
String.class, String.class }); |
260 |
eltList.add(new BarGraph("aggregate_report_median", false, new Color(49, 49, 181))); |
|
|
261 |
eltList.add(new BarGraph("aggregate_report_90%_line", false, new Color(42, 121, 42))); |
262 |
eltList.add(new BarGraph("aggregate_report_min", false, Color.LIGHT_GRAY)); |
263 |
eltList.add(new BarGraph("aggregate_report_max", false, Color.DARK_GRAY)); |
264 |
clearData(); |
265 |
init(); |
266 |
} |
309 |
} |
267 |
|
310 |
|
268 |
// Column renderers |
311 |
// Column renderers |
269 |
private static final TableCellRenderer[] RENDERERS = |
312 |
static final TableCellRenderer[] RENDERERS = |
270 |
new TableCellRenderer[]{ |
313 |
new TableCellRenderer[]{ |
271 |
null, // Label |
314 |
null, // Label |
272 |
null, // count |
315 |
null, // count |
273 |
null, // Mean |
316 |
null, // Mean |
274 |
null, // median |
317 |
null, // median |
275 |
null, // 90% |
318 |
null, // 90% |
|
|
319 |
null, // 95% |
320 |
null, // 99% |
276 |
null, // Min |
321 |
null, // Min |
277 |
null, // Max |
322 |
null, // Max |
278 |
new NumberRenderer("#0.00%"), // Error %age |
323 |
new NumberRenderer("#0.00%"), // Error %age //$NON-NLS-1$ |
279 |
new RateRenderer("#.0"), // Throughpur |
324 |
new RateRenderer("#.0"), // Throughput //$NON-NLS-1$ |
280 |
new NumberRenderer("#.0"), // pageSize |
325 |
new NumberRenderer("#.0"), // pageSize //$NON-NLS-1$ |
281 |
}; |
326 |
}; |
282 |
|
327 |
|
283 |
public static boolean testFunctors(){ |
328 |
public static boolean testFunctors(){ |
Lines 347-353
Link Here
|
347 |
mainPanel.add(makeTitlePanel()); |
392 |
mainPanel.add(makeTitlePanel()); |
348 |
|
393 |
|
349 |
myJTable = new JTable(model); |
394 |
myJTable = new JTable(model); |
350 |
myJTable.setPreferredScrollableViewportSize(new Dimension(500, 80)); |
395 |
// Fix centering of titles |
|
|
396 |
myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer(COLUMNS_MSG_PARAMETERS)); |
397 |
myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70)); |
351 |
RendererUtils.applyRenderers(myJTable, RENDERERS); |
398 |
RendererUtils.applyRenderers(myJTable, RENDERERS); |
352 |
myScrollPane = new JScrollPane(myJTable); |
399 |
myScrollPane = new JScrollPane(myJTable); |
353 |
|
400 |
|
Lines 424-430
Link Here
|
424 |
graphPanel.setMaxLength(maxLength); |
471 |
graphPanel.setMaxLength(maxLength); |
425 |
graphPanel.setMaxYAxisScale(maxYAxisScale); |
472 |
graphPanel.setMaxYAxisScale(maxYAxisScale); |
426 |
graphPanel.setXAxisLabels(getAxisLabels()); |
473 |
graphPanel.setXAxisLabels(getAxisLabels()); |
427 |
graphPanel.setXAxisTitle((String) columnsList.getSelectedItem()); |
474 |
graphPanel.setXAxisTitle(JMeterUtils.getResString((String) columnsList.getSelectedItem())); |
428 |
graphPanel.setYAxisLabels(this.yAxisLabel); |
475 |
graphPanel.setYAxisLabels(this.yAxisLabel); |
429 |
graphPanel.setYAxisTitle(this.yAxisTitle); |
476 |
graphPanel.setYAxisTitle(this.yAxisTitle); |
430 |
graphPanel.setLegendLabels(getLegendLabels()); |
477 |
graphPanel.setLegendLabels(getLegendLabels()); |