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