ASF Bugzilla – Attachment 34716 Details for
Bug 60687
Make GUI more responsive when it gets a lot of events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
In SummaryReport: Move calculations out of AWT thread and refresh GUI only periodically.
0002-Move-calculations-out-of-AWT-thread-and-refresh-GUI-.patch (text/plain), 3.96 KB, created by
Felix Schumacher
on 2017-02-04 15:27:47 UTC
(
hide
)
Description:
In SummaryReport: Move calculations out of AWT thread and refresh GUI only periodically.
Filename:
MIME Type:
Creator:
Felix Schumacher
Created:
2017-02-04 15:27:47 UTC
Size:
3.96 KB
patch
obsolete
>From ae1dd08880b930bf05b1531b25779598c8d5ae16 Mon Sep 17 00:00:00 2001 >From: Felix Schumacher <felix.schumacher@internetallee.de> >Date: Sat, 4 Feb 2017 16:07:12 +0100 >Subject: [PATCH 2/2] Move calculations out of AWT thread and refresh GUI only > periodically. > >--- > .../apache/jmeter/visualizers/SummaryReport.java | 56 ++++++++++++---------- > 1 file changed, 32 insertions(+), 24 deletions(-) > >diff --git a/src/components/org/apache/jmeter/visualizers/SummaryReport.java b/src/components/org/apache/jmeter/visualizers/SummaryReport.java >index 8fc7eda..b1b45be 100644 >--- a/src/components/org/apache/jmeter/visualizers/SummaryReport.java >+++ b/src/components/org/apache/jmeter/visualizers/SummaryReport.java >@@ -38,6 +38,7 @@ import javax.swing.JFileChooser; > import javax.swing.JPanel; > import javax.swing.JScrollPane; > import javax.swing.JTable; >+import javax.swing.Timer; > import javax.swing.border.Border; > import javax.swing.border.EmptyBorder; > import javax.swing.table.TableCellRenderer; >@@ -107,6 +108,8 @@ public class SummaryReport extends AbstractVisualizer implements Clearable, Acti > */ > private final transient Object lock = new Object(); > >+ private volatile boolean dataChanged; >+ > private final Map<String, Calculator> tableRows = new ConcurrentHashMap<>(); > > // Column renderers >@@ -163,6 +166,15 @@ public class SummaryReport extends AbstractVisualizer implements Clearable, Acti > Double.class, Double.class, Double.class, Double.class, Double.class, Double.class }); > clearData(); > init(); >+ new Timer(200, e -> { >+ if (!dataChanged) { >+ return; >+ } >+ dataChanged = false; >+ synchronized (lock) { >+ model.fireTableDataChanged(); >+ } >+ }).start(); > } > > /** >@@ -183,31 +195,26 @@ public class SummaryReport extends AbstractVisualizer implements Clearable, Acti > @Override > public void add(final SampleResult res) { > final String sampleLabel = res.getSampleLabel(useGroupName.isSelected()); >- JMeterUtils.runSafe(false, new Runnable() { >- @Override >- public void run() { >- Calculator row; >- synchronized (lock) { >- row = tableRows.get(sampleLabel); >- if (row == null) { >- row = new Calculator(sampleLabel); >- tableRows.put(row.getLabel(), row); >- model.insertRow(row, model.getRowCount() - 1); >- } >- } >- /* >- * Synch is needed because multiple threads can update the counts. >- */ >- synchronized(row) { >- row.addSample(res); >- } >- Calculator tot = tableRows.get(TOTAL_ROW_LABEL); >- synchronized(tot) { >- tot.addSample(res); >- } >- model.fireTableDataChanged(); >+ Calculator row; >+ synchronized (lock) { >+ row = tableRows.get(sampleLabel); >+ if (row == null) { >+ row = new Calculator(sampleLabel); >+ tableRows.put(row.getLabel(), row); >+ model.insertRow(row, model.getRowCount() - 1); > } >- }); >+ } >+ /* >+ * Synch is needed because multiple threads can update the counts. >+ */ >+ synchronized (row) { >+ row.addSample(res); >+ } >+ Calculator tot = tableRows.get(TOTAL_ROW_LABEL); >+ synchronized (tot) { >+ tot.addSample(res); >+ } >+ dataChanged = true; > } > > /** >@@ -222,6 +229,7 @@ public class SummaryReport extends AbstractVisualizer implements Clearable, Acti > tableRows.put(TOTAL_ROW_LABEL, new Calculator(TOTAL_ROW_LABEL)); > model.addRow(tableRows.get(TOTAL_ROW_LABEL)); > } >+ dataChanged = true; > } > > /** >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60687
:
34714
|
34715
| 34716 |
34717
|
34736
|
34737
|
34738