74a5f5dee693d1be73ec296aa00c1fa2e7da3e68
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / callstack / CallStackEntry.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.tmf.ui.views.callstack;
14
15 import java.util.regex.Pattern;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
19 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
20 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
21
22 /**
23 * An entry, or row, in the Call Stack view
24 *
25 * @author Patrick Tasse
26 */
27 public class CallStackEntry extends TimeGraphEntry {
28
29 private final int fQuark;
30 private final int fStackLevel;
31 private final int fProcessId;
32 private final ITmfTrace fTrace;
33 private String fFunctionName;
34 private long fFunctionEntryTime;
35 private long fFunctionExitTime;
36 private @NonNull ITmfStateSystem fSS;
37
38 /**
39 * Standard constructor
40 *
41 * @param quark
42 * The call stack quark
43 * @param stackLevel
44 * The stack level
45 * @param trace
46 * The trace that this view is talking about
47 * @deprecated Use {@link #CallStackEntry(String, int, int, int, ITmfTrace, ITmfStateSystem)}
48 */
49 @Deprecated
50 public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) {
51 super(null, 0, 0);
52 throw new UnsupportedOperationException();
53 }
54
55 /**
56 * Standard constructor
57 *
58 * @param name
59 * The parent thread name
60 * @param quark
61 * The call stack quark
62 * @param stackLevel
63 * The stack level
64 * @param trace
65 * The trace that this view is talking about
66 * @param ss
67 * The call stack state system
68 * @deprecated Use
69 * {@link #CallStackEntry(String, int, int, int, ITmfTrace, ITmfStateSystem)}
70 */
71 @Deprecated
72 public CallStackEntry(String name, int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
73 super(name, 0, 0);
74 fQuark = quark;
75 fStackLevel = stackLevel;
76 fProcessId = -1;
77 fTrace = trace;
78 fFunctionName = ""; //$NON-NLS-1$
79 fSS = ss;
80 }
81
82 /**
83 * Standard constructor
84 *
85 * @param name
86 * The parent thread name
87 * @param quark
88 * The call stack quark
89 * @param stackLevel
90 * The stack level
91 * @param processId The ID of the process this entry belongs to
92 * @param trace
93 * The trace that this view is talking about
94 * @param ss
95 * The call stack state system
96 * @since 2.0
97 */
98 public CallStackEntry(String name, int quark, int stackLevel, int processId,
99 ITmfTrace trace, @NonNull ITmfStateSystem ss) {
100 super(name, 0, 0);
101 fQuark = quark;
102 fStackLevel = stackLevel;
103 fProcessId = processId;
104 fTrace = trace;
105 fFunctionName = ""; //$NON-NLS-1$
106 fSS = ss;
107 }
108
109 /**
110 * Get the function name of the call stack entry
111 * @return the function name
112 */
113 public String getFunctionName() {
114 return fFunctionName;
115 }
116
117 /**
118 * Set the function name of the call stack entry
119 * @param functionName the function name
120 */
121 public void setFunctionName(String functionName) {
122 fFunctionName = functionName;
123 }
124
125 /**
126 * Set the start time of the call stack entry
127 * @param startTime the start time
128 * @deprecated Use {@link #setFunctionEntryTime(long)}
129 */
130 @Deprecated
131 public void setStartTime(long startTime) {
132 throw new UnsupportedOperationException();
133 }
134
135 /**
136 * Set the end time of the call stack entry
137 * @param endTime the end time
138 * @deprecated Use {@link #setFunctionExitTime(long)}
139 */
140 @Deprecated
141 public void setEndTime(long endTime) {
142 throw new UnsupportedOperationException();
143 }
144
145 /**
146 * Set the selected function entry time
147 *
148 * @param entryTime
149 * the function entry time
150 */
151 public void setFunctionEntryTime(long entryTime) {
152 fFunctionEntryTime = entryTime;
153 }
154
155 /**
156 * Get the selected function entry time
157 *
158 * @return the function entry time
159 */
160 public long getFunctionEntryTime() {
161 return fFunctionEntryTime;
162 }
163
164 /**
165 * Set the selected function exit time
166 *
167 * @param exitTime
168 * the function exit time
169 */
170 public void setFunctionExitTime(long exitTime) {
171 fFunctionExitTime = exitTime;
172 }
173
174 /**
175 * Get the selected function exit time
176 *
177 * @return the function exit time
178 */
179 public long getFunctionExitTime() {
180 return fFunctionExitTime;
181 }
182
183 /**
184 * Retrieve the attribute quark that's represented by this entry.
185 *
186 * @return The integer quark
187 */
188 public int getQuark() {
189 return fQuark;
190 }
191
192 /**
193 * Retrieve the stack level associated with this entry.
194 *
195 * @return The stack level or 0
196 */
197 public int getStackLevel() {
198 return fStackLevel;
199 }
200
201 /**
202 * Retrieve the ID of the process this entry belongs to.
203 *
204 * @return The ID of the process
205 * @since 2.0
206 */
207 public int getProcessId() {
208 return fProcessId;
209 }
210
211 /**
212 * Retrieve the trace that is associated to this view.
213 *
214 * @return The trace
215 */
216 public ITmfTrace getTrace() {
217 return fTrace;
218 }
219
220 /**
221 * Retrieve the call stack state system associated with this entry.
222 *
223 * @return The call stack state system
224 */
225 public @NonNull ITmfStateSystem getStateSystem() {
226 return fSS;
227 }
228
229 @Override
230 public boolean matches(@NonNull Pattern pattern) {
231 return pattern.matcher(fFunctionName).find();
232 }
233
234 }
This page took 0.03683 seconds and 4 git commands to generate.