| author | Mathieu Denis | 2012-08-22 17:34:50 (EDT) |
|---|---|---|
| committer | Alexandre Montplaisir | 2012-08-23 17:50:31 (EDT) |
| commit | 81bd680a9b4d080f11b46385e5166ca5a9717103 (patch) (side-by-side diff) | |
| tree | 9f63f24b199fbaec05c83ae0af3ab2233c7e70f8 | |
| parent | 799c5f89043e2c6527beb34a9f8f8fb24df5c8b3 (diff) | |
| download | org.eclipse.linuxtools-81bd680a9b4d080f11b46385e5166ca5a9717103.zip org.eclipse.linuxtools-81bd680a9b4d080f11b46385e5166ca5a9717103.tar.gz org.eclipse.linuxtools-81bd680a9b4d080f11b46385e5166ca5a9717103.tar.bz2 | |
tmf: Correct the statistics partial event count
Fixes bug 387838
Reload correctly the partial event count in the statistics view when an
experiment is reselected during its indexing.
Change-Id: I1f5aaf7d54812ba2f934e173df5268c7eb24e869
Signed-off-by: Mathieu Denis <mathieu.denis@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/7357
Reviewed-by: Bernd Hufmann <bhufmann@gmail.com>
IP-Clean: Bernd Hufmann <bhufmann@gmail.com>
Tested-by: Bernd Hufmann <bhufmann@gmail.com>
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
2 files changed, 42 insertions, 10 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java index f2770b6..d15f0f2 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/statistics/TmfStatisticsViewer.java @@ -123,6 +123,11 @@ public class TmfStatisticsViewer extends TmfViewer { protected final Object fStatisticsUpdateSyncObj = new Object(); /** + * Update range synchronization object. + */ + protected final Object fStatisticsRangeUpdateSyncObj = new Object(); + + /** * Indicates to process all events */ private boolean fProcessAll; @@ -243,16 +248,18 @@ public class TmfStatisticsViewer extends TmfViewer { return; } - // Sends the time range request only once in this method. - if (fSendRangeRequest) { - fSendRangeRequest = false; - // Calculate the selected time range to request - long startTime = signal.getRange().getStartTime().normalize(0, TIME_SCALE).getValue(); - TmfTimestamp startTS = new TmfTimestamp(startTime, TIME_SCALE); - TmfTimestamp endTS = new TmfTimestamp(startTime + INITIAL_WINDOW_SPAN, TIME_SCALE); - TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS); - - requestTimeRangeData(experiment, timeRange); + synchronized (fStatisticsRangeUpdateSyncObj) { + // Sends the time range request only once from this method. + if (fSendRangeRequest) { + fSendRangeRequest = false; + // Calculate the selected time range to request + long startTime = signal.getRange().getStartTime().normalize(0, TIME_SCALE).getValue(); + TmfTimestamp startTS = new TmfTimestamp(startTime, TIME_SCALE); + TmfTimestamp endTS = new TmfTimestamp(startTime + INITIAL_WINDOW_SPAN, TIME_SCALE); + TmfTimeRange timeRange = new TmfTimeRange(startTS, endTS); + + requestTimeRangeData(experiment, timeRange); + } } requestData(experiment, signal.getRange()); } @@ -383,6 +390,15 @@ public class TmfStatisticsViewer extends TmfViewer { } /** + * Will force a request on the partial event count if one is needed. + */ + public void sendPartialRequestOnNextUpdate() { + synchronized (fStatisticsRangeUpdateSyncObj) { + fSendRangeRequest = true; + } + } + + /** * Focus on the statistics tree of the viewer */ public void setFocus() { diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java index 3504a44..f81d785 100755 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statistics/TmfStatisticsView.java @@ -164,6 +164,22 @@ public class TmfStatisticsView extends TmfView { fExperiment.endSynch(new TmfEndSynchSignal(0)); fRequestData = false; } + } else { + /* + * If the same experiment is reselected, sends a notification to + * the viewers to make sure they reload correctly their partial + * event count. + */ + TmfStatisticsViewer statsViewer; + for (ITmfViewer viewer : fStatsViewers.getViewers()) { + if (!(viewer instanceof TmfStatisticsViewer)) { + Activator.getDefault().logError("Error - cannot cast viewer to a statistics viewer"); //$NON-NLS-1$ + continue; + } + statsViewer = (TmfStatisticsViewer) viewer; + // Will update the partial event count if needed. + statsViewer.sendPartialRequestOnNextUpdate(); + } } } } |

