From 32ba3b099c8eebb6c61fff1113a3be07d7eb6030 Mon Sep 17 00:00:00 2001 From: Patrick Tasse Date: Thu, 7 Apr 2016 17:15:23 -0400 Subject: [PATCH] analysis: Remove zoomed event list handling from Critical Path View The Critical Path View does not use a zoomed event list so there is no need to fake it. Its event list is built by the HorizontalLinksVisitor, and contains all time events regardless of the resolution. The zoomed event list was built only once for the full entry range and was therefore strictly equal to the full event list. It was not more detailed (since the full event list is already at the most detailed level) and it was not a subset of the event list for the current time range, since the zoom thread never updated it, due to the CriticalPathBaseEntry having no child entries, preventing any recursion into the deeper entries. Change-Id: I469ef9314dcbcc835a5ef03c93d9ca11c5f7eb70 Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/70184 Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien Reviewed-by: Francis Giraldeau --- .../criticalpath/view/CriticalPathView.java | 51 ++----------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java b/analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java index 115035ddee..67a5bfe4fc 100644 --- a/analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java +++ b/analysis/org.eclipse.tracecompass.analysis.graph.ui/src/org/eclipse/tracecompass/internal/analysis/graph/ui/criticalpath/view/CriticalPathView.java @@ -15,12 +15,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jface.viewers.Viewer; @@ -269,9 +267,6 @@ public class CriticalPathView extends AbstractTimeGraphView { list.add(defaultParent); } - for (TimeGraphEntry entry : list) { - buildStatusEvents(trace, (CriticalPathEntry) entry); - } workerEntries.put(worker, list); } @@ -472,22 +467,6 @@ public class CriticalPathView extends AbstractTimeGraphView { return state; } - private void buildStatusEvents(ITmfTrace trace, CriticalPathEntry entry) { - - long start = trace.getStartTime().getValue(); - long end = trace.getEndTime().getValue() + 1; - long resolution = Math.max(1, (end - start) / getDisplayWidth()); - List eventList = getEventList(entry, entry.getStartTime(), entry.getEndTime(), resolution, new NullProgressMonitor()); - - entry.setZoomedEventList(eventList); - - redraw(); - - for (ITimeGraphEntry child : entry.getChildren()) { - buildStatusEvents(trace, (CriticalPathEntry) child); - } - } - @Override protected void buildEventList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor) { /* This class uses a content provider instead */ @@ -497,31 +476,11 @@ public class CriticalPathView extends AbstractTimeGraphView { protected @Nullable List getEventList(TimeGraphEntry entry, long startTime, long endTime, long resolution, IProgressMonitor monitor) { - - final long realStart = Math.max(startTime, entry.getStartTime()); - final long realEnd = Math.min(endTime, entry.getEndTime()); - if (realEnd <= realStart) { - return null; - } - List eventList = null; - entry.setZoomedEventList(null); - Iterator iterator = entry.getTimeEventsIterator(); - eventList = new ArrayList<>(); - - while (iterator.hasNext()) { - ITimeEvent event = iterator.next(); - /* is event visible */ - if (intersects(realStart, realEnd, event)) { - eventList.add(event); - } - } - return eventList; - } - - private static boolean intersects(final long realStart, final long realEnd, ITimeEvent event) { - return ((event.getTime() >= realStart) && (event.getTime() <= realEnd)) || - ((event.getTime() + event.getDuration() > realStart) && - (event.getTime() + event.getDuration() < realEnd)); + /* + * The event list is built in the HorizontalLinksVisitor. This is called + * only from the zoom thread and only for the CriticalPathBaseEntry. + */ + return null; } @Override -- 2.34.1