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