Extract the linux-kernel-specific things into their own plugin
[deliverable/tracecompass.git] / org.eclipse.tracecompass.analysis.os.linux.ui / src / org / eclipse / tracecompass / analysis / os / linux / ui / views / controlflow / ControlFlowView.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson, École Polytechnique de Montréal
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 * Geneviève Bastien - Move code to provide base classes for time graph view
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.analysis.os.linux.ui.views.controlflow;
15
16 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
18 import java.util.ArrayList;
19 import java.util.Comparator;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.eclipse.core.runtime.IProgressMonitor;
25 import org.eclipse.jdt.annotation.NonNull;
26 import org.eclipse.jdt.annotation.Nullable;
27 import org.eclipse.jface.action.IAction;
28 import org.eclipse.jface.action.IToolBarManager;
29 import org.eclipse.jface.dialogs.IDialogSettings;
30 import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.Attributes;
31 import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysis;
32 import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelThreadInformationProvider;
33 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
34 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Messages;
35 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
36 import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
37 import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
38 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
39 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
40 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
41 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
42 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
43 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
44 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
45 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
46 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
47 import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
48 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
49 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
50 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
51 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent;
52 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
53 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeLinkEvent;
54 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils;
55 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.Resolution;
56 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat;
57
58 /**
59 * The Control Flow view main object
60 *
61 */
62 public class ControlFlowView extends AbstractTimeGraphView {
63
64 // ------------------------------------------------------------------------
65 // Constants
66 // ------------------------------------------------------------------------
67
68 /**
69 * View ID.
70 */
71 public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.views.controlflow"; //$NON-NLS-1$
72
73 private static final String PROCESS_COLUMN = Messages.ControlFlowView_processColumn;
74 private static final String TID_COLUMN = Messages.ControlFlowView_tidColumn;
75 private static final String PTID_COLUMN = Messages.ControlFlowView_ptidColumn;
76 private static final String BIRTH_TIME_COLUMN = Messages.ControlFlowView_birthTimeColumn;
77 private static final String TRACE_COLUMN = Messages.ControlFlowView_traceColumn;
78
79 private static final String[] COLUMN_NAMES = new String[] {
80 PROCESS_COLUMN,
81 TID_COLUMN,
82 PTID_COLUMN,
83 BIRTH_TIME_COLUMN,
84 TRACE_COLUMN
85 };
86
87 private static final String[] FILTER_COLUMN_NAMES = new String[] {
88 PROCESS_COLUMN,
89 TID_COLUMN
90 };
91
92 // Timeout between updates in the build thread in ms
93 private static final long BUILD_UPDATE_TIMEOUT = 500;
94
95 // ------------------------------------------------------------------------
96 // Constructors
97 // ------------------------------------------------------------------------
98
99 /**
100 * Constructor
101 */
102 public ControlFlowView() {
103 super(ID, new ControlFlowPresentationProvider());
104 setTreeColumns(COLUMN_NAMES);
105 setTreeLabelProvider(new ControlFlowTreeLabelProvider());
106 setFilterColumns(FILTER_COLUMN_NAMES);
107 setFilterLabelProvider(new ControlFlowFilterLabelProvider());
108 setEntryComparator(new ControlFlowEntryComparator());
109 }
110
111 @Override
112 protected void fillLocalToolBar(IToolBarManager manager) {
113 super.fillLocalToolBar(manager);
114 IDialogSettings settings = Activator.getDefault().getDialogSettings();
115 IDialogSettings section = settings.getSection(getClass().getName());
116 if (section == null) {
117 section = settings.addNewSection(getClass().getName());
118 }
119
120 IAction hideArrowsAction = getTimeGraphCombo().getTimeGraphViewer().getHideArrowsAction(section);
121 manager.add(hideArrowsAction);
122
123 IAction followArrowBwdAction = getTimeGraphCombo().getTimeGraphViewer().getFollowArrowBwdAction();
124 followArrowBwdAction.setText(Messages.ControlFlowView_followCPUBwdText);
125 followArrowBwdAction.setToolTipText(Messages.ControlFlowView_followCPUBwdText);
126 manager.add(followArrowBwdAction);
127
128 IAction followArrowFwdAction = getTimeGraphCombo().getTimeGraphViewer().getFollowArrowFwdAction();
129 followArrowFwdAction.setText(Messages.ControlFlowView_followCPUFwdText);
130 followArrowFwdAction.setToolTipText(Messages.ControlFlowView_followCPUFwdText);
131 manager.add(followArrowFwdAction);
132 }
133
134 @Override
135 protected String getNextText() {
136 return Messages.ControlFlowView_nextProcessActionNameText;
137 }
138
139 @Override
140 protected String getNextTooltip() {
141 return Messages.ControlFlowView_nextProcessActionToolTipText;
142 }
143
144 @Override
145 protected String getPrevText() {
146 return Messages.ControlFlowView_previousProcessActionNameText;
147 }
148
149 @Override
150 protected String getPrevTooltip() {
151 return Messages.ControlFlowView_previousProcessActionToolTipText;
152 }
153
154 private static class ControlFlowEntryComparator implements Comparator<ITimeGraphEntry> {
155
156 @Override
157 public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
158
159 int result = 0;
160
161 if ((o1 instanceof ControlFlowEntry) && (o2 instanceof ControlFlowEntry)) {
162 ControlFlowEntry entry1 = (ControlFlowEntry) o1;
163 ControlFlowEntry entry2 = (ControlFlowEntry) o2;
164 result = entry1.getTrace().getStartTime().compareTo(entry2.getTrace().getStartTime());
165 if (result == 0) {
166 result = entry1.getTrace().getName().compareTo(entry2.getTrace().getName());
167 }
168 if (result == 0) {
169 result = entry1.getThreadId() < entry2.getThreadId() ? -1 : entry1.getThreadId() > entry2.getThreadId() ? 1 : 0;
170 }
171 }
172
173 if (result == 0) {
174 result = o1.getStartTime() < o2.getStartTime() ? -1 : o1.getStartTime() > o2.getStartTime() ? 1 : 0;
175 }
176
177 return result;
178 }
179 }
180
181 /**
182 * @author gbastien
183 *
184 */
185 protected static class ControlFlowTreeLabelProvider extends TreeLabelProvider {
186
187 @Override
188 public String getColumnText(Object element, int columnIndex) {
189 ControlFlowEntry entry = (ControlFlowEntry) element;
190
191 if (COLUMN_NAMES[columnIndex].equals(Messages.ControlFlowView_processColumn)) {
192 return entry.getName();
193 } else if (COLUMN_NAMES[columnIndex].equals(Messages.ControlFlowView_tidColumn)) {
194 return Integer.toString(entry.getThreadId());
195 } else if (COLUMN_NAMES[columnIndex].equals(Messages.ControlFlowView_ptidColumn)) {
196 if (entry.getParentThreadId() > 0) {
197 return Integer.toString(entry.getParentThreadId());
198 }
199 } else if (COLUMN_NAMES[columnIndex].equals(Messages.ControlFlowView_birthTimeColumn)) {
200 return Utils.formatTime(entry.getStartTime(), TimeFormat.CALENDAR, Resolution.NANOSEC);
201 } else if (COLUMN_NAMES[columnIndex].equals(Messages.ControlFlowView_traceColumn)) {
202 return entry.getTrace().getName();
203 }
204 return ""; //$NON-NLS-1$
205 }
206
207 }
208
209 private static class ControlFlowFilterLabelProvider extends TreeLabelProvider {
210
211 @Override
212 public String getColumnText(Object element, int columnIndex) {
213 ControlFlowEntry entry = (ControlFlowEntry) element;
214
215 if (columnIndex == 0) {
216 return entry.getName();
217 } else if (columnIndex == 1) {
218 return Integer.toString(entry.getThreadId());
219 }
220 return ""; //$NON-NLS-1$
221 }
222
223 }
224
225 // ------------------------------------------------------------------------
226 // Internal
227 // ------------------------------------------------------------------------
228
229 @Override
230 protected void buildEventList(final ITmfTrace trace, ITmfTrace parentTrace, IProgressMonitor monitor) {
231 ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysis.ID);
232 if (ssq == null) {
233 return;
234 }
235
236 List<ControlFlowEntry> entryList = new ArrayList<>();
237 Map<Integer, ControlFlowEntry> entryMap = new HashMap<>();
238
239 long start = ssq.getStartTime();
240 setStartTime(Math.min(getStartTime(), start));
241
242 boolean complete = false;
243 while (!complete) {
244 if (monitor.isCanceled()) {
245 return;
246 }
247 complete = ssq.waitUntilBuilt(BUILD_UPDATE_TIMEOUT);
248 if (ssq.isCancelled()) {
249 return;
250 }
251 long end = ssq.getCurrentEndTime();
252 if (start == end && !complete) { // when complete execute one last time regardless of end time
253 continue;
254 }
255 setEndTime(Math.max(getEndTime(), end + 1));
256 List<Integer> threadQuarks = ssq.getQuarks(Attributes.THREADS, "*"); //$NON-NLS-1$
257 for (int threadQuark : threadQuarks) {
258 if (monitor.isCanceled()) {
259 return;
260 }
261 String threadName = ssq.getAttributeName(threadQuark);
262 int threadId = -1;
263 try {
264 threadId = Integer.parseInt(threadName);
265 } catch (NumberFormatException e1) {
266 continue;
267 }
268 if (threadId <= 0) { // ignore the 'unknown' (-1) and swapper (0) threads
269 continue;
270 }
271
272 int execNameQuark;
273 List<ITmfStateInterval> execNameIntervals;
274 try {
275 execNameQuark = ssq.getQuarkRelative(threadQuark, Attributes.EXEC_NAME);
276 execNameIntervals = StateSystemUtils.queryHistoryRange(ssq, execNameQuark, start, end);
277 } catch (AttributeNotFoundException e) {
278 /* No information on this thread (yet?), skip it for now */
279 continue;
280 } catch (StateSystemDisposedException e) {
281 /* State system is closing down, no point continuing */
282 break;
283 }
284
285 for (ITmfStateInterval execNameInterval : execNameIntervals) {
286 if (monitor.isCanceled()) {
287 return;
288 }
289 ControlFlowEntry entry = entryMap.get(threadId);
290 if (!execNameInterval.getStateValue().isNull() &&
291 execNameInterval.getStateValue().getType() == ITmfStateValue.Type.STRING) {
292 String execName = execNameInterval.getStateValue().unboxStr();
293 long startTime = execNameInterval.getStartTime();
294 long endTime = execNameInterval.getEndTime() + 1;
295
296 if (entry == null) {
297 ITmfStateInterval ppidInterval = null;
298 try {
299 int ppidQuark = ssq.getQuarkRelative(threadQuark, Attributes.PPID);
300 ppidInterval = StateSystemUtils.queryUntilNonNullValue(ssq, ppidQuark, startTime, endTime);
301 } catch (AttributeNotFoundException e) {
302 /* No info, keep PPID at -1 */
303 }
304
305 int ppid = -1;
306 if (ppidInterval != null) {
307 ppid = ppidInterval.getStateValue().unboxInt();
308 }
309 entry = new ControlFlowEntry(threadQuark, trace, execName, threadId, ppid, startTime, endTime);
310 entryList.add(entry);
311 entryMap.put(threadId, entry);
312 } else {
313 // update the name of the entry to the latest
314 // execName
315 entry.setName(execName);
316 entry.updateEndTime(endTime);
317 }
318 } else {
319 entryMap.remove(threadId);
320 }
321 }
322 }
323
324 updateTree(entryList, parentTrace);
325
326 if (parentTrace.equals(getTrace())) {
327 refresh();
328 }
329
330 for (ControlFlowEntry entry : entryList) {
331 if (monitor.isCanceled()) {
332 return;
333 }
334 buildStatusEvents(entry.getTrace(), entry, monitor, start, end);
335 }
336
337 start = end;
338 }
339 }
340
341 private void updateTree(List<ControlFlowEntry> entryList, ITmfTrace parentTrace) {
342 List<TimeGraphEntry> rootListToAdd = new ArrayList<>();
343 List<TimeGraphEntry> rootListToRemove = new ArrayList<>();
344 List<TimeGraphEntry> rootList = getEntryList(parentTrace);
345
346 for (ControlFlowEntry entry : entryList) {
347 boolean root = (entry.getParent() == null);
348 if (root && entry.getParentThreadId() > 0) {
349 for (ControlFlowEntry parent : entryList) {
350 /*
351 * Associate the parent entry only if their time overlap. A
352 * child entry may start before its parent, for example at
353 * the beginning of the trace if a parent has not yet
354 * appeared in the state system. We just want to make sure
355 * that the entry didn't start after the parent ended or
356 * ended before the parent started.
357 */
358 if (parent.getThreadId() == entry.getParentThreadId() &&
359 !(entry.getStartTime() > parent.getEndTime() ||
360 entry.getEndTime() < parent.getStartTime())) {
361 parent.addChild(entry);
362 root = false;
363 if (rootList != null && rootList.contains(entry)) {
364 rootListToRemove.add(entry);
365 }
366 break;
367 }
368 }
369 }
370 if (root && (rootList == null || !rootList.contains(entry))) {
371 rootListToAdd.add(entry);
372 }
373 }
374
375 addToEntryList(parentTrace, rootListToAdd);
376 removeFromEntryList(parentTrace, rootListToRemove);
377 }
378
379 private void buildStatusEvents(ITmfTrace trace, ControlFlowEntry entry, @NonNull IProgressMonitor monitor, long start, long end) {
380 if (start < entry.getEndTime() && end > entry.getStartTime()) {
381 ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(entry.getTrace(), KernelAnalysis.ID);
382 if (ssq == null) {
383 return;
384 }
385
386 long startTime = Math.max(start, entry.getStartTime());
387 long endTime = Math.min(end + 1, entry.getEndTime());
388 long resolution = Math.max(1, (end - ssq.getStartTime()) / getDisplayWidth());
389 List<ITimeEvent> eventList = getEventList(entry, startTime, endTime, resolution, monitor);
390 if (eventList == null) {
391 return;
392 }
393 for (ITimeEvent event : eventList) {
394 entry.addEvent(event);
395 }
396 if (trace.equals(getTrace())) {
397 redraw();
398 }
399 }
400 for (ITimeGraphEntry child : entry.getChildren()) {
401 if (monitor.isCanceled()) {
402 return;
403 }
404 buildStatusEvents(trace, (ControlFlowEntry) child, monitor, start, end);
405 }
406 }
407
408 @Override
409 protected @Nullable List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) {
410 List<ITimeEvent> eventList = null;
411 if (!(tgentry instanceof ControlFlowEntry)) {
412 return eventList;
413 }
414 ControlFlowEntry entry = (ControlFlowEntry) tgentry;
415 final long realStart = Math.max(startTime, entry.getStartTime());
416 final long realEnd = Math.min(endTime, entry.getEndTime());
417 if (realEnd <= realStart) {
418 return null;
419 }
420 KernelAnalysis kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(entry.getTrace(), KernelAnalysis.class, KernelAnalysis.ID);
421 if (kernelAnalysis == null) {
422 // ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(entry.getTrace(), KernelAnalysis.ID);
423 // if (ssq == null) {
424 return null;
425 }
426 try {
427 List<ITmfStateInterval> statusIntervals = KernelThreadInformationProvider.getStatusIntervalsForThread(
428 kernelAnalysis, checkNotNull(entry.getThreadId()), realStart, realEnd, resolution, monitor);
429 eventList = new ArrayList<>(statusIntervals.size());
430 long lastEndTime = -1;
431 for (ITmfStateInterval statusInterval : statusIntervals) {
432 if (monitor.isCanceled()) {
433 return null;
434 }
435 long time = statusInterval.getStartTime();
436 long duration = statusInterval.getEndTime() - time + 1;
437 int status = -1;
438 try {
439 status = statusInterval.getStateValue().unboxInt();
440 } catch (StateValueTypeException e) {
441 e.printStackTrace();
442 }
443 if (lastEndTime != time && lastEndTime != -1) {
444 eventList.add(new TimeEvent(entry, lastEndTime, time - lastEndTime));
445 }
446 eventList.add(new TimeEvent(entry, time, duration, status));
447 lastEndTime = time + duration;
448 }
449 } catch (TimeRangeException e) {
450 Activator.getDefault().logError(e.getMessage());
451 }
452 return eventList;
453 }
454
455 /**
456 * Returns a value corresponding to the selected entry.
457 *
458 * Used in conjunction with synchingToTime to change the selected entry. If
459 * one of these methods is overridden in child class, then both should be.
460 *
461 * @param time
462 * The currently selected time
463 * @return a value identifying the entry
464 */
465 private int getSelectionValue(long time) {
466 int thread = -1;
467 ITmfTrace[] traces = TmfTraceManager.getTraceSet(getTrace());
468 if (traces == null) {
469 return thread;
470 }
471 for (ITmfTrace trace : traces) {
472 if (thread > 0) {
473 break;
474 }
475 if (trace == null) {
476 continue;
477 }
478 ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysis.ID);
479 if (ssq == null) {
480 continue;
481 }
482 if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) {
483 List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); //$NON-NLS-1$
484 for (int currentThreadQuark : currentThreadQuarks) {
485 try {
486 ITmfStateInterval currentThreadInterval = ssq.querySingleState(time, currentThreadQuark);
487 int currentThread = currentThreadInterval.getStateValue().unboxInt();
488 if (currentThread > 0) {
489 int statusQuark = ssq.getQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThread), Attributes.STATUS);
490 ITmfStateInterval statusInterval = ssq.querySingleState(time, statusQuark);
491 if (statusInterval.getStartTime() == time) {
492 thread = currentThread;
493 break;
494 }
495 }
496 } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
497 e.printStackTrace();
498 } catch (StateSystemDisposedException e) {
499 /* Ignored */
500 }
501 }
502 }
503 }
504 return thread;
505 }
506
507 @Override
508 protected void synchingToTime(long time) {
509 int selected = getSelectionValue(time);
510 if (selected > 0) {
511 for (Object element : getTimeGraphViewer().getExpandedElements()) {
512 if (element instanceof ControlFlowEntry) {
513 ControlFlowEntry entry = (ControlFlowEntry) element;
514 if (entry.getThreadId() == selected) {
515 getTimeGraphCombo().setSelection(entry);
516 break;
517 }
518 }
519 }
520 }
521 }
522
523 @Override
524 protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) {
525 List<ILinkEvent> list = new ArrayList<>();
526 ITmfTrace[] traces = TmfTraceManager.getTraceSet(getTrace());
527 List<TimeGraphEntry> entryList = getEntryList(getTrace());
528 if (traces == null || entryList == null) {
529 return list;
530 }
531 for (ITmfTrace trace : traces) {
532 if (trace == null) {
533 continue;
534 }
535 ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysis.ID);
536 if (ssq == null) {
537 continue;
538 }
539 try {
540 long start = Math.max(startTime, ssq.getStartTime());
541 long end = Math.min(endTime, ssq.getCurrentEndTime());
542 if (end < start) {
543 continue;
544 }
545 List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); //$NON-NLS-1$
546 for (int currentThreadQuark : currentThreadQuarks) {
547 // adjust the query range to include the previous and following intervals
548 long qstart = Math.max(ssq.querySingleState(start, currentThreadQuark).getStartTime() - 1, ssq.getStartTime());
549 long qend = Math.min(ssq.querySingleState(end, currentThreadQuark).getEndTime() + 1, ssq.getCurrentEndTime());
550 List<ITmfStateInterval> currentThreadIntervals = StateSystemUtils.queryHistoryRange(ssq, currentThreadQuark, qstart, qend, resolution, monitor);
551 int prevThread = 0;
552 long prevEnd = 0;
553 long lastEnd = 0;
554 for (ITmfStateInterval currentThreadInterval : currentThreadIntervals) {
555 if (monitor.isCanceled()) {
556 return null;
557 }
558 long time = currentThreadInterval.getStartTime();
559 if (time != lastEnd) {
560 // don't create links where there are gaps in intervals due to the resolution
561 prevThread = 0;
562 prevEnd = 0;
563 }
564 int thread = currentThreadInterval.getStateValue().unboxInt();
565 if (thread > 0 && prevThread > 0) {
566 ITimeGraphEntry prevEntry = findEntry(entryList, trace, prevThread);
567 ITimeGraphEntry nextEntry = findEntry(entryList, trace, thread);
568 list.add(new TimeLinkEvent(prevEntry, nextEntry, prevEnd, time - prevEnd, 0));
569 }
570 lastEnd = currentThreadInterval.getEndTime() + 1;
571 if (thread != 0) {
572 prevThread = thread;
573 prevEnd = lastEnd;
574 }
575 }
576 }
577 } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) {
578 e.printStackTrace();
579 } catch (StateSystemDisposedException e) {
580 /* Ignored */
581 }
582 }
583 return list;
584 }
585
586 private ControlFlowEntry findEntry(List<? extends ITimeGraphEntry> entryList, ITmfTrace trace, int threadId) {
587 for (ITimeGraphEntry entry : entryList) {
588 if (entry instanceof ControlFlowEntry) {
589 ControlFlowEntry controlFlowEntry = (ControlFlowEntry) entry;
590 if (controlFlowEntry.getThreadId() == threadId && controlFlowEntry.getTrace() == trace) {
591 return controlFlowEntry;
592 } else if (entry.hasChildren()) {
593 controlFlowEntry = findEntry(entry.getChildren(), trace, threadId);
594 if (controlFlowEntry != null) {
595 return controlFlowEntry;
596 }
597 }
598 }
599 }
600 return null;
601 }
602 }
This page took 0.049276 seconds and 5 git commands to generate.