package org.eclipse.linuxtools.tmf.ui.views.callstack;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.EventIterator;
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
/**
* An entry, or row, in the Call Stack view
* @author Patrick Tasse
* @since 2.0
*/
-public class CallStackEntry implements ITimeGraphEntry {
+public class CallStackEntry extends TimeGraphEntry {
private final int fQuark;
private final int fStackLevel;
private final ITmfTrace fTrace;
- private ITimeGraphEntry fParent = null;
- private String fName;
private String fFunctionName;
- private long fStartTime;
- private long fEndTime;
- private List<ITimeEvent> fEventList = new ArrayList<>(1);
- private List<ITimeEvent> fZoomedEventList = null;
+ private long fFunctionEntryTime;
+ private long fFunctionExitTime;
private @NonNull ITmfStateSystem fSS;
/**
* The stack level
* @param trace
* The trace that this view is talking about
- * @deprecated Use {@link #CallStackEntry(int, int, ITmfTrace, ITmfStateSystem)}
+ * @deprecated Use {@link #CallStackEntry(String, int, int, ITmfTrace, ITmfStateSystem)}
*/
@Deprecated
public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) {
+ super(null, 0, 0);
throw new UnsupportedOperationException();
}
/**
* Standard constructor
*
+ * @param name
+ * The parent thread name
* @param quark
* The call stack quark
* @param stackLevel
* The call stack state system
* @since 3.1
*/
- public CallStackEntry(int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
+ public CallStackEntry(String name, int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
+ super(name, 0, 0);
fQuark = quark;
fStackLevel = stackLevel;
fTrace = trace;
fSS = ss;
}
- @Override
- public ITimeGraphEntry getParent() {
- return fParent;
- }
-
- @Override
- public boolean hasChildren() {
- return false;
- }
-
- @Override
- public List<CallStackEntry> getChildren() {
- return null;
- }
-
- @Override
- public String getName() {
- return ""; //$NON-NLS-1$
- }
-
/**
* Get the function name of the call stack entry
* @return the function name
fFunctionName = functionName;
}
- @Override
- public long getStartTime() {
- return fStartTime;
- }
-
/**
* Set the start time of the call stack entry
* @param startTime the start time
+ * @deprecated Use {@link #setFunctionEntryTime(long)}
*/
+ @Deprecated
public void setStartTime(long startTime) {
- fStartTime = startTime;
- }
-
- @Override
- public long getEndTime() {
- return fEndTime;
+ throw new UnsupportedOperationException();
}
/**
* Set the end time of the call stack entry
* @param endTime the end time
+ * @deprecated Use {@link #setFunctionExitTime(long)}
*/
+ @Deprecated
public void setEndTime(long endTime) {
- fEndTime = endTime;
+ throw new UnsupportedOperationException();
}
- @Override
- public boolean hasTimeEvents() {
- return fEventList != null;
+ /**
+ * Set the selected function entry time
+ *
+ * @param entryTime
+ * the function entry time
+ * @since 3.1
+ */
+ public void setFunctionEntryTime(long entryTime) {
+ fFunctionEntryTime = entryTime;
}
- @Override
- public Iterator<ITimeEvent> getTimeEventsIterator() {
- return new EventIterator(fEventList, fZoomedEventList);
+ /**
+ * Get the selected function entry time
+ *
+ * @return the function entry time
+ * @since 3.1
+ */
+ public long getFunctionEntryTime() {
+ return fFunctionEntryTime;
}
- @Override
- public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
- return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);
+ /**
+ * Set the selected function exit time
+ *
+ * @param exitTime
+ * the function exit time
+ * @since 3.1
+ */
+ public void setFunctionExitTime(long exitTime) {
+ fFunctionExitTime = exitTime;
}
/**
- * Assign a parent entry to this one, to organize them in a tree in the
- * view.
+ * Get the selected function exit time
*
- * @param parent
- * The parent entry
+ * @return the function exit time
+ * @since 3.1
*/
- public void setParent(ITimeGraphEntry parent) {
- fParent = parent;
+ public long getFunctionExitTime() {
+ return fFunctionExitTime;
}
/**
return fSS;
}
- /**
- * Assign the target event list to this view.
- *
- * @param eventList
- * The list of time events
- */
- public void setEventList(List<ITimeEvent> eventList) {
- fEventList = eventList;
- if (eventList != null && eventList.size() > 0) {
- fStartTime = eventList.get(0).getTime();
- ITimeEvent lastEvent = eventList.get(eventList.size() - 1);
- fEndTime = lastEvent.getTime() + lastEvent.getDuration();
- }
- }
-
- /**
- * Assign the zoomed event list to this view.
- *
- * @param eventList
- * The list of "zoomed" time events
- */
- public void setZoomedEventList(List<ITimeEvent> eventList) {
- fZoomedEventList = eventList;
- }
-
- /**
- * Add an event to the event list
- *
- * @param timeEvent
- * The event
- */
- public void addEvent(ITimeEvent timeEvent) {
- fEventList.add(timeEvent);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " name=" + fName; //$NON-NLS-1$
- }
}