Commit | Line | Data |
---|---|---|
e8251298 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2013, 2014 Ericsson |
e8251298 PT |
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 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.ui.views.callstack; |
e8251298 | 14 | |
36299425 JCK |
15 | import java.util.regex.Pattern; |
16 | ||
da27e43a | 17 | import org.eclipse.jdt.annotation.NonNull; |
e894a508 | 18 | import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; |
2bdf0193 AM |
19 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; |
20 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry; | |
e8251298 PT |
21 | |
22 | /** | |
23 | * An entry, or row, in the Call Stack view | |
24 | * | |
25 | * @author Patrick Tasse | |
e8251298 | 26 | */ |
60b4d44c | 27 | public class CallStackEntry extends TimeGraphEntry { |
e8251298 PT |
28 | |
29 | private final int fQuark; | |
30 | private final int fStackLevel; | |
4ce4d8af | 31 | private final int fProcessId; |
e8251298 | 32 | private final ITmfTrace fTrace; |
e8251298 | 33 | private String fFunctionName; |
60b4d44c PT |
34 | private long fFunctionEntryTime; |
35 | private long fFunctionExitTime; | |
da27e43a | 36 | private @NonNull ITmfStateSystem fSS; |
e8251298 | 37 | |
4ce4d8af AM |
38 | /** |
39 | * Standard constructor | |
40 | * | |
41 | * @param name | |
42 | * The parent thread name | |
43 | * @param quark | |
44 | * The call stack quark | |
45 | * @param stackLevel | |
46 | * The stack level | |
47 | * @param processId The ID of the process this entry belongs to | |
48 | * @param trace | |
49 | * The trace that this view is talking about | |
50 | * @param ss | |
51 | * The call stack state system | |
52 | * @since 2.0 | |
53 | */ | |
54 | public CallStackEntry(String name, int quark, int stackLevel, int processId, | |
55 | ITmfTrace trace, @NonNull ITmfStateSystem ss) { | |
56 | super(name, 0, 0); | |
57 | fQuark = quark; | |
58 | fStackLevel = stackLevel; | |
59 | fProcessId = processId; | |
e8251298 PT |
60 | fTrace = trace; |
61 | fFunctionName = ""; //$NON-NLS-1$ | |
da27e43a | 62 | fSS = ss; |
e8251298 PT |
63 | } |
64 | ||
e8251298 PT |
65 | /** |
66 | * Get the function name of the call stack entry | |
67 | * @return the function name | |
68 | */ | |
69 | public String getFunctionName() { | |
70 | return fFunctionName; | |
71 | } | |
72 | ||
73 | /** | |
74 | * Set the function name of the call stack entry | |
75 | * @param functionName the function name | |
76 | */ | |
77 | public void setFunctionName(String functionName) { | |
78 | fFunctionName = functionName; | |
79 | } | |
80 | ||
60b4d44c PT |
81 | /** |
82 | * Set the selected function entry time | |
83 | * | |
84 | * @param entryTime | |
85 | * the function entry time | |
60b4d44c PT |
86 | */ |
87 | public void setFunctionEntryTime(long entryTime) { | |
88 | fFunctionEntryTime = entryTime; | |
e8251298 PT |
89 | } |
90 | ||
60b4d44c PT |
91 | /** |
92 | * Get the selected function entry time | |
93 | * | |
94 | * @return the function entry time | |
60b4d44c PT |
95 | */ |
96 | public long getFunctionEntryTime() { | |
97 | return fFunctionEntryTime; | |
e8251298 PT |
98 | } |
99 | ||
60b4d44c PT |
100 | /** |
101 | * Set the selected function exit time | |
102 | * | |
103 | * @param exitTime | |
104 | * the function exit time | |
60b4d44c PT |
105 | */ |
106 | public void setFunctionExitTime(long exitTime) { | |
107 | fFunctionExitTime = exitTime; | |
e8251298 PT |
108 | } |
109 | ||
110 | /** | |
60b4d44c | 111 | * Get the selected function exit time |
e8251298 | 112 | * |
60b4d44c | 113 | * @return the function exit time |
e8251298 | 114 | */ |
60b4d44c PT |
115 | public long getFunctionExitTime() { |
116 | return fFunctionExitTime; | |
e8251298 PT |
117 | } |
118 | ||
119 | /** | |
120 | * Retrieve the attribute quark that's represented by this entry. | |
121 | * | |
122 | * @return The integer quark | |
123 | */ | |
124 | public int getQuark() { | |
125 | return fQuark; | |
126 | } | |
127 | ||
128 | /** | |
129 | * Retrieve the stack level associated with this entry. | |
130 | * | |
131 | * @return The stack level or 0 | |
132 | */ | |
133 | public int getStackLevel() { | |
134 | return fStackLevel; | |
135 | } | |
136 | ||
4ce4d8af AM |
137 | /** |
138 | * Retrieve the ID of the process this entry belongs to. | |
139 | * | |
140 | * @return The ID of the process | |
141 | * @since 2.0 | |
142 | */ | |
143 | public int getProcessId() { | |
144 | return fProcessId; | |
145 | } | |
146 | ||
e8251298 PT |
147 | /** |
148 | * Retrieve the trace that is associated to this view. | |
149 | * | |
150 | * @return The trace | |
151 | */ | |
152 | public ITmfTrace getTrace() { | |
153 | return fTrace; | |
154 | } | |
155 | ||
da27e43a PT |
156 | /** |
157 | * Retrieve the call stack state system associated with this entry. | |
158 | * | |
159 | * @return The call stack state system | |
da27e43a PT |
160 | */ |
161 | public @NonNull ITmfStateSystem getStateSystem() { | |
162 | return fSS; | |
163 | } | |
164 | ||
36299425 JCK |
165 | @Override |
166 | public boolean matches(@NonNull Pattern pattern) { | |
167 | return pattern.matcher(fFunctionName).find(); | |
168 | } | |
169 | ||
e8251298 | 170 | } |