2010-10-26 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug309042
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / resources / evProcessor / ResourcesFinishUpdateHandler.java
CommitLineData
6e512b93
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 Ericsson
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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;
13
14import org.eclipse.linuxtools.lttng.event.LttngEvent;
15import org.eclipse.linuxtools.lttng.state.StateStrings.Events;
16import org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor;
17import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
18import org.eclipse.linuxtools.lttng.ui.TraceDebug;
19import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventResource;
6e512b93
ASL
20
21/**
22 * Creates specific finish state data request
23 *
24 * @author alvaro
25 *
26 */
27public class ResourcesFinishUpdateHandler extends
28 AbsResourcesTRangeUpdate
29 implements ILttngEventProcessor {
30
31 public Events getEventHandleType() {
32 // No specific event
33 return null;
34 }
35
d4011df2 36 @Override
6e512b93 37 public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) {
a72a38d9
ASL
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;
6e512b93 42
a72a38d9
ASL
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;
47 }
48
6e512b93
ASL
49 TraceDebug.debug("Number of localResources: "
50 + resContainer.readItems().length);
51
52 // for each existing resource
53 for (TimeRangeEventResource localResource : resContainer
54 .readItems()) {
55
56 // get the start time
57 long stime = localResource.getNext_good_time();
58
59 // Get the resource state mode
60 String stateMode = localResource.getStateMode(traceSt);
61
62 // Insert an instance from previous time to end request time with
63 // the current state
a72a38d9 64 makeDraw(traceSt, stime, endOfEvent, localResource, params, stateMode);
6e512b93
ASL
65 }
66
67 return false;
68 }
69
70}
This page took 0.030586 seconds and 5 git commands to generate.