1 /*******************************************************************************
2 * Copyright (c) 2009 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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 * Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
12 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.resources
.evProcessor
;
15 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.event
.LttngEvent
;
16 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.state
.StateStrings
.Events
;
17 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.state
.evProcessor
.ILttngEventProcessor
;
18 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.state
.model
.LttngTraceState
;
19 import org
.eclipse
.linuxtools
.lttng
.ui
.TraceDebug
;
20 import org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
.TimeRangeEventResource
;
23 * Creates specific finish state data request
28 public class ResourcesFinishUpdateHandler
extends
29 AbsResourcesTRangeUpdate
30 implements ILttngEventProcessor
{
32 public Events
getEventHandleType() {
38 public boolean process(LttngEvent trcEvent
, LttngTraceState traceSt
) {
39 // The end of the last state is unknown since it's beyond the requested time range window. Create this last
40 // event to half page after the visible window but not beyond the end of trace
41 long endOfTrace
= traceSt
.getContext().getTraceTimeWindow().getEndTime().getValue();
42 long halfWindow
= (params
.getEndTime() - params
.getStartTime()) / 2;
44 // End of event common to all resources within the trace for this specific request
45 long endOfEvent
= params
.getEndTime() + halfWindow
;
46 if (endOfEvent
> endOfTrace
) {
47 endOfEvent
= endOfTrace
;
50 TraceDebug
.debug("Number of localResources: " //$NON-NLS-1$
51 + resContainer
.readItems().length
);
53 // for each existing resource
54 for (TimeRangeEventResource localResource
: resContainer
58 long stime
= localResource
.getNext_good_time();
60 // Get the resource state mode
61 String stateMode
= localResource
.getStateMode(traceSt
);
63 // Insert an instance from previous time to end request time with
65 makeDraw(traceSt
, stime
, endOfEvent
, localResource
, params
, stateMode
);