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; | |
20 | import org.eclipse.linuxtools.tmf.event.TmfTimestamp; | |
21 | ||
22 | /** | |
23 | * Creates specific finish state data request | |
24 | * | |
25 | * @author alvaro | |
26 | * | |
27 | */ | |
28 | public class ResourcesFinishUpdateHandler extends | |
29 | AbsResourcesTRangeUpdate | |
30 | implements ILttngEventProcessor { | |
31 | ||
32 | public Events getEventHandleType() { | |
33 | // No specific event | |
34 | return null; | |
35 | } | |
36 | ||
37 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
38 | // Draw a last known state to the end of the trace | |
39 | TmfTimestamp endReqTime = traceSt.getContext() | |
40 | .getTraceTimeWindow().getEndTime(); | |
41 | ||
42 | TraceDebug.debug("Number of localResources: " | |
43 | + resContainer.readItems().length); | |
44 | ||
45 | // for each existing resource | |
46 | for (TimeRangeEventResource localResource : resContainer | |
47 | .readItems()) { | |
48 | ||
49 | // get the start time | |
50 | long stime = localResource.getNext_good_time(); | |
51 | ||
52 | // Get the resource state mode | |
53 | String stateMode = localResource.getStateMode(traceSt); | |
54 | ||
55 | // Insert an instance from previous time to end request time with | |
56 | // the current state | |
57 | makeDraw(traceSt, stime, endReqTime.getValue(), | |
58 | localResource, params, stateMode); | |
59 | } | |
60 | ||
61 | return false; | |
62 | } | |
63 | ||
64 | } |