1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
4 * All rights reserved. This program and the accompanying materials are made
5 * 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
9 * Contributors: Alvaro Sanchez-Leon - Initial implementation
10 *******************************************************************************/
11 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.controlflow
.evProcessor
;
13 import java
.util
.Vector
;
15 import org
.eclipse
.linuxtools
.lttng
.event
.LttngEvent
;
16 import org
.eclipse
.linuxtools
.lttng
.state
.StateStrings
.Events
;
17 import org
.eclipse
.linuxtools
.lttng
.state
.evProcessor
.ILttngEventProcessor
;
18 import org
.eclipse
.linuxtools
.lttng
.state
.model
.LttngProcessState
;
19 import org
.eclipse
.linuxtools
.lttng
.state
.model
.LttngTraceState
;
20 import org
.eclipse
.linuxtools
.lttng
.ui
.TraceDebug
;
21 import org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
.TimeRangeComponent
;
22 import org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
.TimeRangeEvent
;
23 import org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
.TimeRangeEventProcess
;
26 * Creates specific finish state data request
31 public class FlowFinishUpdateHandler
extends AbsFlowTRangeUpdate
32 implements ILttngEventProcessor
{
34 public Events
getEventHandleType() {
39 public boolean process(LttngEvent trcEvent
, LttngTraceState traceSt
) {
40 // Draw a last known state to the end of the trace
41 long endReqTime
= traceSt
.getContext().getTraceTimeWindow()
42 .getEndTime().getValue();
43 TraceDebug
.debug("Number of localProcesses: "
44 + procContainer
.readItems().length
);
45 // to identify the process relevant to the traceState
46 String traceId
= traceSt
.getTraceId();
47 int numLocalFound
= 0;
48 int numLocalNotFound
= 0;
49 int numWithNoChildren
= 0;
50 for (TimeRangeEventProcess localProcess
: procContainer
.readItems()) {
51 LttngProcessState stateProcess
= lttv_state_find_process(traceSt
,
52 localProcess
.getCpu(), localProcess
.getPid());
54 // Drawing the last state for processes related to the current trace
56 if (!localProcess
.getTraceID().equals(traceId
)) {
60 // Check if the process is in the state provider, it is the case
61 // when the requested time frame did not include any events for a
63 if (stateProcess
== null) {
64 // Get Start time from the end time of previous event
65 Vector
<TimeRangeComponent
> childrenEvents
= localProcess
69 if (childrenEvents
.size() > 0) {
70 TimeRangeComponent prevEvent
= childrenEvents
71 .get(childrenEvents
.size() - 1);
72 if (prevEvent
instanceof TimeRangeEvent
) {
73 TimeRangeEvent prevTimeRange
= (TimeRangeEvent
) prevEvent
;
74 // calculate the next good time to draw the event
75 // nextGoodTime = prevTimeRange.getStopTime() + 1;
76 nextGoodTime
= localProcess
.getNext_good_time();
77 stateMode
= prevTimeRange
.getStateMode();
79 // Draw with the Local information since the current
81 // not contain events related to this process
82 makeDraw(traceSt
, nextGoodTime
,
83 endReqTime
, localProcess
, params
, stateMode
);
86 .debug("previous event not instance of TimeRangeEvent?: "
87 + prevEvent
.getClass().getSimpleName());
97 // Draw the last state for this process
99 makeDraw(traceSt
, endReqTime
, stateProcess
, localProcess
, params
);
102 TraceDebug
.debug("Print Last Event: NumLocalFound " + numLocalFound
103 + "; NumLocalNotFound: " + numLocalNotFound
104 + "; NumWithNoChildren: " + numWithNoChildren
);