| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2013 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.linuxtools.tmf.ui.views.callstack; |
| 14 | |
| 15 | import org.eclipse.jdt.annotation.NonNull; |
| 16 | import org.eclipse.linuxtools.statesystem.core.ITmfStateSystem; |
| 17 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; |
| 18 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeGraphEntry; |
| 19 | |
| 20 | /** |
| 21 | * An entry, or row, in the Call Stack view |
| 22 | * |
| 23 | * @author Patrick Tasse |
| 24 | * @since 2.0 |
| 25 | */ |
| 26 | public class CallStackEntry extends TimeGraphEntry { |
| 27 | |
| 28 | private final int fQuark; |
| 29 | private final int fStackLevel; |
| 30 | private final ITmfTrace fTrace; |
| 31 | private String fFunctionName; |
| 32 | private long fFunctionEntryTime; |
| 33 | private long fFunctionExitTime; |
| 34 | private @NonNull ITmfStateSystem fSS; |
| 35 | |
| 36 | /** |
| 37 | * Standard constructor |
| 38 | * |
| 39 | * @param quark |
| 40 | * The call stack quark |
| 41 | * @param stackLevel |
| 42 | * The stack level |
| 43 | * @param trace |
| 44 | * The trace that this view is talking about |
| 45 | * @deprecated Use {@link #CallStackEntry(String, int, int, ITmfTrace, ITmfStateSystem)} |
| 46 | */ |
| 47 | @Deprecated |
| 48 | public CallStackEntry(int quark, int stackLevel, ITmfTrace trace) { |
| 49 | super(null, 0, 0); |
| 50 | throw new UnsupportedOperationException(); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Standard constructor |
| 55 | * |
| 56 | * @param name |
| 57 | * The parent thread name |
| 58 | * @param quark |
| 59 | * The call stack quark |
| 60 | * @param stackLevel |
| 61 | * The stack level |
| 62 | * @param trace |
| 63 | * The trace that this view is talking about |
| 64 | * @param ss |
| 65 | * The call stack state system |
| 66 | * @since 3.1 |
| 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 | * @since 3.1 |
| 119 | */ |
| 120 | public void setFunctionEntryTime(long entryTime) { |
| 121 | fFunctionEntryTime = entryTime; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Get the selected function entry time |
| 126 | * |
| 127 | * @return the function entry time |
| 128 | * @since 3.1 |
| 129 | */ |
| 130 | public long getFunctionEntryTime() { |
| 131 | return fFunctionEntryTime; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Set the selected function exit time |
| 136 | * |
| 137 | * @param exitTime |
| 138 | * the function exit time |
| 139 | * @since 3.1 |
| 140 | */ |
| 141 | public void setFunctionExitTime(long exitTime) { |
| 142 | fFunctionExitTime = exitTime; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Get the selected function exit time |
| 147 | * |
| 148 | * @return the function exit time |
| 149 | * @since 3.1 |
| 150 | */ |
| 151 | public long getFunctionExitTime() { |
| 152 | return fFunctionExitTime; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * Retrieve the attribute quark that's represented by this entry. |
| 157 | * |
| 158 | * @return The integer quark |
| 159 | */ |
| 160 | public int getQuark() { |
| 161 | return fQuark; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Retrieve the stack level associated with this entry. |
| 166 | * |
| 167 | * @return The stack level or 0 |
| 168 | */ |
| 169 | public int getStackLevel() { |
| 170 | return fStackLevel; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Retrieve the trace that is associated to this view. |
| 175 | * |
| 176 | * @return The trace |
| 177 | */ |
| 178 | public ITmfTrace getTrace() { |
| 179 | return fTrace; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Retrieve the call stack state system associated with this entry. |
| 184 | * |
| 185 | * @return The call stack state system |
| 186 | * @since 3.1 |
| 187 | */ |
| 188 | public @NonNull ITmfStateSystem getStateSystem() { |
| 189 | return fSS; |
| 190 | } |
| 191 | |
| 192 | } |