1 /*******************************************************************************
2 * Copyright (c) 2013 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.callstack
;
15 import java
.util
.ArrayList
;
16 import java
.util
.Iterator
;
17 import java
.util
.List
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
20 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.EventIterator
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
22 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
25 * An entry, or row, in the Call Stack view
27 * @author Patrick Tasse
30 public class CallStackEntry
implements ITimeGraphEntry
{
32 private final int fQuark
;
33 private final int fStackLevel
;
34 private final ITmfTrace fTrace
;
35 private ITimeGraphEntry fParent
= null;
37 private String fFunctionName
;
38 private long fStartTime
;
39 private long fEndTime
;
40 private List
<ITimeEvent
> fEventList
= new ArrayList
<ITimeEvent
>(1);
41 private List
<ITimeEvent
> fZoomedEventList
= null;
44 * Standard constructor
47 * The event stack quark
51 * The trace that this view is talking about
53 public CallStackEntry(int quark
, int stackLevel
, ITmfTrace trace
) {
55 fStackLevel
= stackLevel
;
57 fFunctionName
= ""; //$NON-NLS-1$
61 public ITimeGraphEntry
getParent() {
66 public boolean hasChildren() {
71 public List
<CallStackEntry
> getChildren() {
76 public String
getName() {
77 return ""; //$NON-NLS-1$
81 * Get the function name of the call stack entry
82 * @return the function name
84 public String
getFunctionName() {
89 * Set the function name of the call stack entry
90 * @param functionName the function name
92 public void setFunctionName(String functionName
) {
93 fFunctionName
= functionName
;
97 public long getStartTime() {
102 * Set the start time of the call stack entry
103 * @param startTime the start time
105 public void setStartTime(long startTime
) {
106 fStartTime
= startTime
;
110 public long getEndTime() {
115 * Set the end time of the call stack entry
116 * @param endTime the end time
118 public void setEndTime(long endTime
) {
123 public boolean hasTimeEvents() {
124 return fEventList
!= null;
128 public Iterator
<ITimeEvent
> getTimeEventsIterator() {
129 return new EventIterator(fEventList
, fZoomedEventList
);
133 public Iterator
<ITimeEvent
> getTimeEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
134 return new EventIterator(fEventList
, fZoomedEventList
, startTime
, stopTime
);
138 * Assign a parent entry to this one, to organize them in a tree in the
144 public void setParent(ITimeGraphEntry parent
) {
149 * Retrieve the attribute quark that's represented by this entry.
151 * @return The integer quark
153 public int getQuark() {
158 * Retrieve the stack level associated with this entry.
160 * @return The stack level or 0
162 public int getStackLevel() {
167 * Retrieve the trace that is associated to this view.
171 public ITmfTrace
getTrace() {
176 * Assign the target event list to this view.
179 * The list of time events
181 public void setEventList(List
<ITimeEvent
> eventList
) {
182 fEventList
= eventList
;
183 if (eventList
!= null && eventList
.size() > 0) {
184 fStartTime
= eventList
.get(0).getTime();
185 ITimeEvent lastEvent
= eventList
.get(eventList
.size() - 1);
186 fEndTime
= lastEvent
.getTime() + lastEvent
.getDuration();
191 * Assign the zoomed event list to this view.
194 * The list of "zoomed" time events
196 public void setZoomedEventList(List
<ITimeEvent
> eventList
) {
197 fZoomedEventList
= eventList
;
201 * Add an event to the event list
206 public void addEvent(ITimeEvent timeEvent
) {
207 fEventList
.add(timeEvent
);
211 public String
toString() {
212 return getClass().getSimpleName() + " name=" + fName
; //$NON-NLS-1$
This page took 0.037017 seconds and 6 git commands to generate.