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 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.resources
.evProcessor
;
14 import org
.eclipse
.linuxtools
.lttng
.event
.LttngEvent
;
15 import org
.eclipse
.linuxtools
.lttng
.state
.StateStrings
.Events
;
16 import org
.eclipse
.linuxtools
.lttng
.state
.evProcessor
.ILttngEventProcessor
;
17 import org
.eclipse
.linuxtools
.lttng
.state
.model
.LttngTraceState
;
18 import org
.eclipse
.linuxtools
.lttng
.ui
.TraceDebug
;
19 import org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
.TimeRangeEventResource
;
22 * Creates specific finish state data request
27 public class ResourcesFinishUpdateHandler
extends
28 AbsResourcesTRangeUpdate
29 implements ILttngEventProcessor
{
31 public Events
getEventHandleType() {
37 public boolean process(LttngEvent trcEvent
, LttngTraceState traceSt
) {
38 // The end of the last state is unknown since it's beyond the requested time range window. Create this last
39 // event to half page after the visible window but not beyond the end of trace
40 long endOfTrace
= traceSt
.getContext().getTraceTimeWindow().getEndTime().getValue();
41 long halfWindow
= (params
.getEndTime() - params
.getStartTime()) / 2;
43 // End of event common to all resources within the trace for this specific request
44 long endOfEvent
= params
.getEndTime() + halfWindow
;
45 if (endOfEvent
> endOfTrace
) {
46 endOfEvent
= endOfTrace
;
49 TraceDebug
.debug("Number of localResources: "
50 + resContainer
.readItems().length
);
52 // for each existing resource
53 for (TimeRangeEventResource localResource
: resContainer
57 long stime
= localResource
.getNext_good_time();
59 // Get the resource state mode
60 String stateMode
= localResource
.getStateMode(traceSt
);
62 // Insert an instance from previous time to end request time with
64 makeDraw(traceSt
, stime
, endOfEvent
, localResource
, params
, stateMode
);