Commit | Line | Data |
---|---|---|
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 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor; | |
13 | ||
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; | |
6e512b93 ASL |
20 | |
21 | /** | |
22 | * Creates specific finish state data request | |
23 | * | |
24 | * @author alvaro | |
25 | * | |
26 | */ | |
27 | public 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 | } |