/*******************************************************************************
- * Copyright (c) 2015 École Polytechnique de Montréal
+ * Copyright (c) 2015, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
}
@Override
- protected void buildEventList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor) {
+ protected void buildEntryList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor) {
/* This class uses a content provider instead */
}
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson, École Polytechnique de Montréal and others.
+ * Copyright (c) 2012, 2016 Ericsson, École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
// ------------------------------------------------------------------------
@Override
- protected void buildEventList(final ITmfTrace trace, final ITmfTrace parentTrace, final IProgressMonitor monitor) {
+ protected void buildEntryList(final ITmfTrace trace, final ITmfTrace parentTrace, final IProgressMonitor monitor) {
final ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID);
if (ssq == null) {
return;
}
@Override
- protected void buildEventList(ITmfTrace trace, ITmfTrace parentTrace, final IProgressMonitor monitor) {
+ protected void buildEntryList(ITmfTrace trace, ITmfTrace parentTrace, final IProgressMonitor monitor) {
final ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID);
if (ssq == null) {
return;
if (parentTrace.equals(getTrace())) {
refresh();
}
- final List<? extends ITimeGraphEntry> traceEntryChildren = traceEntry.getChildren();
+ final List<@NonNull TimeGraphEntry> traceEntryChildren = traceEntry.getChildren();
final long resolution = Math.max(1, (endTime - ssq.getStartTime()) / getDisplayWidth());
final long qStart = start;
final long qEnd = end;
queryFullStates(ssq, qStart, qEnd, resolution, monitor, new IQueryHandler() {
@Override
public void handle(List<List<ITmfStateInterval>> fullStates, List<ITmfStateInterval> prevFullState) {
- for (ITimeGraphEntry child : traceEntryChildren) {
+ for (TimeGraphEntry child : traceEntryChildren) {
if (!populateEventsRecursively(fullStates, prevFullState, child).isOK()) {
return;
}
}
}
- private IStatus populateEventsRecursively(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState, ITimeGraphEntry entry) {
+ private IStatus populateEventsRecursively(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState, @NonNull TimeGraphEntry entry) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if (entry instanceof TimeGraphEntry) {
- TimeGraphEntry timeGraphEntry = (TimeGraphEntry) entry;
- List<ITimeEvent> eventList = getEventList(timeGraphEntry, ssq, fullStates, prevFullState, monitor);
- if (eventList != null) {
- for (ITimeEvent event : eventList) {
- timeGraphEntry.addEvent(event);
- }
+ List<ITimeEvent> eventList = getEventList(entry, ssq, fullStates, prevFullState, monitor);
+ if (eventList != null) {
+ for (ITimeEvent event : eventList) {
+ entry.addEvent(event);
}
}
- for (ITimeGraphEntry child : entry.getChildren()) {
+ for (TimeGraphEntry child : entry.getChildren()) {
IStatus status = populateEventsRecursively(fullStates, prevFullState, child);
if (!status.isOK()) {
return status;
return null;
}
- private static List<ITimeEvent> createCpuEventsList(TimeGraphEntry entry, ITmfStateSystem ssq, List<List<ITmfStateInterval>> fullStates, List<ITmfStateInterval> prevFullState, IProgressMonitor monitor, int quark) {
+ private static List<ITimeEvent> createCpuEventsList(ITimeGraphEntry entry, ITmfStateSystem ssq, List<List<ITmfStateInterval>> fullStates, List<ITmfStateInterval> prevFullState, IProgressMonitor monitor, int quark) {
List<ITimeEvent> eventList;
int statusQuark;
try {
return eventList;
}
- private static List<ITimeEvent> createIrqEventsList(TimeGraphEntry entry, List<List<ITmfStateInterval>> fullStates, List<ITmfStateInterval> prevFullState, IProgressMonitor monitor, int quark) {
+ private static List<ITimeEvent> createIrqEventsList(ITimeGraphEntry entry, List<List<ITmfStateInterval>> fullStates, List<ITmfStateInterval> prevFullState, IProgressMonitor monitor, int quark) {
List<ITimeEvent> eventList;
eventList = new ArrayList<>(fullStates.size());
ITmfStateInterval lastInterval = prevFullState == null || quark >= prevFullState.size() ? null : prevFullState.get(quark);
// ------------------------------------------------------------------------
@Override
- protected void buildEventList(ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
+ protected void buildEntryList(ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
setStartTime(Long.MAX_VALUE);
setEndTime(Long.MIN_VALUE);
List<ITimeEvent> eventList = getEventList(entry, startTime, endTime, resolution, monitor);
entry.setEventList(eventList);
redraw();
- for (ITimeGraphEntry child : entry.getChildren()) {
- if (!(child instanceof TimeGraphEntry)) {
- continue;
- }
+ for (TimeGraphEntry child : entry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
- buildEntryEventList((TimeGraphEntry) child, ssq, start, end, monitor);
+ buildEntryEventList(child, ssq, start, end, monitor);
}
}
}
* The parent VM entry will contain the thread intervals for all
* threads. Just take the list from there
*/
- ITimeGraphEntry parent = vmEntry.getParent();
+ TimeGraphEntry parent = vmEntry.getParent();
while (threadIntervals == null && parent != null) {
if (parent instanceof VirtualMachineViewEntry) {
threadIntervals = ((VirtualMachineViewEntry) parent).getThreadIntervals(vmEntry.getNumericId());
}
- if (parent instanceof TimeGraphEntry) {
- parent = ((TimeGraphEntry) parent).getParent();
- }
+ parent = parent.getParent();
}
return threadIntervals;
}
/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
// ------------------------------------------------------------------------
@Override
- protected void buildEventList(ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
+ protected void buildEntryList(ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
/*
* Get the view element from the XML file. If the element can't be
}
@Override
- protected void buildEventList(final ITmfTrace trace, final ITmfTrace parentTrace, final IProgressMonitor monitor) {
+ protected void buildEntryList(final ITmfTrace trace, final ITmfTrace parentTrace, final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return;
}
/*******************************************************************************
- * Copyright (c) 2015 Ericsson
+ * Copyright (c) 2015, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
import com.google.common.collect.HashMultimap;
}
});
}
- for (ITimeGraphEntry child : entry.getChildren()) {
+ for (TimeGraphEntry child : entry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
- if (child instanceof TimeGraphEntry) {
- zoom((TimeGraphEntry) child, ss, fullStates, prevFullState, monitor);
- }
+ zoom(child, ss, fullStates, prevFullState, monitor);
}
}
private void clearZoomedList(TimeGraphEntry entry) {
entry.setZoomedEventList(null);
- for (ITimeGraphEntry child : entry.getChildren()) {
- if (child instanceof TimeGraphEntry) {
- clearZoomedList((TimeGraphEntry) child);
- }
+ for (TimeGraphEntry child : entry.getChildren()) {
+ clearZoomedList(child);
}
}
}
/**
* Gets the list of events for an entry for a given list of full states.
+ * <p>
+ * Called from the ZoomThread for every entry to update the zoomed event
+ * list. Can be an empty implementation if the view does not support zoomed
+ * event lists. Can also be used to compute the full event list.
*
* @param tgentry
* The time graph entry
@Override
public void run() {
- buildEventList(fBuildTrace, fParentTrace, fMonitor);
+ buildEntryList(fBuildTrace, fParentTrace, fMonitor);
synchronized (fBuildThreadMap) {
fBuildThreadMap.remove(fBuildTrace);
}
}
}
redraw();
- for (ITimeGraphEntry child : entry.getChildren()) {
+ for (TimeGraphEntry child : entry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
- if (child instanceof TimeGraphEntry) {
- zoom((TimeGraphEntry) child, monitor);
- }
+ zoom(child, monitor);
}
}
}
/**
- * Build the entries list to show in this time graph
- *
- * Called from the BuildThread
+ * Build the entry list to show in this time graph view.
+ * <p>
+ * Called from the BuildThread for each trace returned by
+ * {@link #getTracesToBuild(ITmfTrace)}. The full event list is also
+ * normally computed for every entry that is created.
*
* @param trace
* The trace being built
* The parent of the trace set, or the trace itself
* @param monitor
* The progress monitor object
+ * @since 2.0
*/
- protected abstract void buildEventList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor);
+ protected abstract void buildEntryList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor);
/**
- * Gets the list of event for an entry in a given timerange
+ * Gets the list of event for an entry in a given time range.
+ * <p>
+ * Called from the ZoomThread for every entry to update the zoomed event
+ * list. Can be an empty implementation if the view does not support zoomed
+ * event lists. Can also be used to compute the full event list.
*
* @param entry
* The entry to get events for
fEntryMenuManager.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
- fillTimeGraphEntryContextMenu(fEntryMenuManager);
+ fillTimeGraphEntryContextMenu(fEntryMenuManager);
fEntryMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
});
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2012, 2016 Ericsson, École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
public class TimeGraphEntry implements ITimeGraphEntry {
/** Entry's parent */
- private ITimeGraphEntry fParent = null;
+ private TimeGraphEntry fParent = null;
/** List of child entries */
- private final List<@NonNull ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
+ private final List<@NonNull TimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
/** Name of this entry (text to show) */
private String fName;
// Getters and setters
// ---------------------------------------------
- @Override
- public ITimeGraphEntry getParent() {
- return fParent;
- }
-
/**
- * Sets the entry's parent
- *
- * @param entry The new parent entry
- */
- /*
- * TODO: This method can be removed in the next major API version.
+ * @since 2.0
*/
- protected void setParent(TimeGraphEntry entry) {
- fParent = entry;
+ @Override
+ public TimeGraphEntry getParent() {
+ return fParent;
}
/**
* Sets the entry's parent
*
* @param entry The new parent entry
+ * @since 2.0
*/
- /*
- * TODO: This method should be added to the interface in the next major API version.
- */
- protected void setParent(ITimeGraphEntry entry) {
+ public void setParent(TimeGraphEntry entry) {
fParent = entry;
}
}
@Override
- public synchronized List<@NonNull ? extends ITimeGraphEntry> getChildren() {
+ public synchronized List<@NonNull TimeGraphEntry> getChildren() {
return fChildren;
}
}
}
- /**
- * Add a child entry to this one
- *
- * @param child
- * The child entry
- */
- /*
- * TODO: This method can be removed in the next major API version.
- */
- public synchronized void addChild(@NonNull TimeGraphEntry child) {
- addChild((ITimeGraphEntry) child);
- }
-
/**
* Add a child entry to this one. If a comparator was previously set with
* {@link #sortChildren(Comparator)}, the entry will be inserted in its
* @param child
* The child entry
*/
- public synchronized void addChild(@NonNull ITimeGraphEntry child) {
- /*
- * TODO: Use setParent() once it is added to the interface.
- */
- if (child instanceof TimeGraphEntry) {
- ((TimeGraphEntry) child).fParent = this;
- }
+ public synchronized void addChild(@NonNull TimeGraphEntry child) {
+ child.setParent(this);
if (fComparator == null) {
fChildren.add(child);
} else {
* Index at which the specified entry is to be inserted
* @param child
* The child entry
+ * @since 2.0
*/
- public synchronized void addChild(int index, @NonNull ITimeGraphEntry child) {
- /*
- * TODO: Use setParent() once it is added to the interface.
- */
- if (child instanceof TimeGraphEntry) {
- ((TimeGraphEntry) child).fParent = this;
- }
+ public synchronized void addChild(int index, @NonNull TimeGraphEntry child) {
+ child.setParent(this);
fChildren.add(index, child);
}
/**
* Sort the children of this entry using the provided comparator. Subsequent
- * calls to {@link #addChild(ITimeGraphEntry)} will use this comparator to
+ * calls to {@link #addChild(TimeGraphEntry)} will use this comparator to
* maintain the sort order.
*
* @param comparator
if (comparator == null) {
return;
}
- @NonNull ITimeGraphEntry[] array = fChildren.toArray(new @NonNull ITimeGraphEntry[0]);
+ @NonNull TimeGraphEntry[] array = fChildren.toArray(new @NonNull TimeGraphEntry[0]);
Arrays.sort(array, comparator);
fChildren.clear();
fChildren.addAll(Arrays.asList(array));