0c364b33ef17e61da1645f7e11dd7ef3e2b971f0
1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.controlflow
;
15 import java
.util
.ArrayList
;
16 import java
.util
.Iterator
;
17 import java
.util
.List
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.common
.EventIterator
;
20 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.trace
.CtfKernelTrace
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
22 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
24 public class ControlFlowEntry
implements ITimeGraphEntry
, Comparable
<ControlFlowEntry
> {
25 private int fThreadQuark
;
26 private CtfKernelTrace fTrace
;
27 private ControlFlowEntry fParent
= null;
28 private ArrayList
<ControlFlowEntry
> fChildren
= new ArrayList
<ControlFlowEntry
>();
30 private int fThreadId
;
32 private long fBirthTime
= -1;
33 private long fStartTime
= -1;
34 private long fEndTime
= -1;
35 private List
<ITimeEvent
> fEventList
= new ArrayList
<ITimeEvent
>();
36 private List
<ITimeEvent
> fZoomedEventList
= null;
38 public ControlFlowEntry(int threadQuark
, CtfKernelTrace trace
, String execName
, int threadId
, int ppid
, long birthTime
, long startTime
, long endTime
) {
39 fThreadQuark
= threadQuark
;
44 fBirthTime
= birthTime
;
45 fStartTime
= startTime
;
50 public ITimeGraphEntry
getParent() {
55 public boolean hasChildren() {
56 return fChildren
!= null && fChildren
.size() > 0;
60 public ControlFlowEntry
[] getChildren() {
61 return fChildren
.toArray(new ControlFlowEntry
[0]);
65 public String
getName() {
70 public long getStartTime() {
75 public long getEndTime() {
80 public boolean hasTimeEvents() {
85 public Iterator
<ITimeEvent
> getTimeEventsIterator() {
86 return new EventIterator(fEventList
, fZoomedEventList
);
90 public Iterator
<ITimeEvent
> getTimeEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
91 return new EventIterator(fEventList
, fZoomedEventList
, startTime
, stopTime
);
95 public int compareTo(ControlFlowEntry other
) {
96 int result
= this.fThreadId
< other
.fThreadId ?
-1 : this.fThreadId
> other
.fThreadId ?
1 : 0;
98 result
= this.fStartTime
< other
.fStartTime ?
-1 : this.fStartTime
> other
.fStartTime ?
1 : 0;
103 public int getThreadQuark() {
107 public CtfKernelTrace
getTrace() {
111 public int getThreadId() {
115 public int getPPID() {
119 public long getBirthTime() {
123 public void addEvent(ITimeEvent event
) {
124 long start
= event
.getTime();
125 long end
= start
+ event
.getDuration();
126 synchronized (fEventList
) {
127 fEventList
.add(event
);
128 if (fStartTime
== -1 || start
< fStartTime
) {
131 if (fEndTime
== -1 || end
> fEndTime
) {
137 public void setEventList(List
<ITimeEvent
> eventList
) {
138 fEventList
= eventList
;
141 public void setZoomedEventList(List
<ITimeEvent
> eventList
) {
142 fZoomedEventList
= eventList
;
145 public void addChild(ControlFlowEntry child
) {
146 child
.fParent
= this;
147 fChildren
.add(child
);
This page took 0.032938 seconds and 5 git commands to generate.