c388cd232ce92d24eb03482957c055077e974581
[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 ITmfTrace fTrace;
32 private String fFunctionName;
33 private long fFunctionEntryTime;
34 private long fFunctionExitTime;
35 private @NonNull ITmfStateSystem fSS;
36
37 /**
38 * Standard constructor
39 *
40 * @param quark
41 * The call stack quark
42 * @param stackLevel
43 * The stack level
44 * @param trace
45 * The trace that this view is talking about
46 * @deprecated Use {@link #CallStackEntry(String, int, int, ITmfTrace, ITmfStateSystem)}
47 */
48 @Deprecated
49 public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) {
50 super(null, 0, 0);
51 throw new UnsupportedOperationException();
52 }
53
54 /**
55 * Standard constructor
56 *
57 * @param name
58 * The parent thread name
59 * @param quark
60 * The call stack quark
61 * @param stackLevel
62 * The stack level
63 * @param trace
64 * The trace that this view is talking about
65 * @param ss
66 * The call stack state system
67 */
68 public CallStackEntry(String name, int quark, int stackLevel, ITmfTrace trace, @NonNull ITmfStateSystem ss) {
69 super(name, 0, 0);
70 fQuark = quark;
71 fStackLevel = stackLevel;
72 fTrace = trace;
73 fFunctionName = ""; //$NON-NLS-1$
74 fSS = ss;
75 }
76
77 /**
78 * Get the function name of the call stack entry
79 * @return the function name
80 */
81 public String getFunctionName() {
82 return fFunctionName;
83 }
84
85 /**
86 * Set the function name of the call stack entry
87 * @param functionName the function name
88 */
89 public void setFunctionName(String functionName) {
90 fFunctionName = functionName;
91 }
92
93 /**
94 * Set the start time of the call stack entry
95 * @param startTime the start time
96 * @deprecated Use {@link #setFunctionEntryTime(long)}
97 */
98 @Deprecated
99 public void setStartTime(long startTime) {
100 throw new UnsupportedOperationException();
101 }
102
103 /**
104 * Set the end time of the call stack entry
105 * @param endTime the end time
106 * @deprecated Use {@link #setFunctionExitTime(long)}
107 */
108 @Deprecated
109 public void setEndTime(long endTime) {
110 throw new UnsupportedOperationException();
111 }
112
113 /**
114 * Set the selected function entry time
115 *
116 * @param entryTime
117 * the function entry time
118 */
119 public void setFunctionEntryTime(long entryTime) {
120 fFunctionEntryTime = entryTime;
121 }
122
123 /**
124 * Get the selected function entry time
125 *
126 * @return the function entry time
127 */
128 public long getFunctionEntryTime() {
129 return fFunctionEntryTime;
130 }
131
132 /**
133 * Set the selected function exit time
134 *
135 * @param exitTime
136 * the function exit time
137 */
138 public void setFunctionExitTime(long exitTime) {
139 fFunctionExitTime = exitTime;
140 }
141
142 /**
143 * Get the selected function exit time
144 *
145 * @return the function exit time
146 */
147 public long getFunctionExitTime() {
148 return fFunctionExitTime;
149 }
150
151 /**
152 * Retrieve the attribute quark that's represented by this entry.
153 *
154 * @return The integer quark
155 */
156 public int getQuark() {
157 return fQuark;
158 }
159
160 /**
161 * Retrieve the stack level associated with this entry.
162 *
163 * @return The stack level or 0
164 */
165 public int getStackLevel() {
166 return fStackLevel;
167 }
168
169 /**
170 * Retrieve the trace that is associated to this view.
171 *
172 * @return The trace
173 */
174 public ITmfTrace getTrace() {
175 return fTrace;
176 }
177
178 /**
179 * Retrieve the call stack state system associated with this entry.
180 *
181 * @return The call stack state system
182 */
183 public @NonNull ITmfStateSystem getStateSystem() {
184 return fSS;
185 }
186
187 @Override
188 public boolean matches(@NonNull Pattern pattern) {
189 return pattern.matcher(fFunctionName).find();
190 }
191
192 }
This page took 0.036441 seconds and 5 git commands to generate.