tmf: Use tabs in statistics view for each traces
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / internal / lttng / ui / views / resources / evProcessor / ResourcesFinishUpdateHandler.java
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 * Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
12 *******************************************************************************/
13 package org.eclipse.linuxtools.internal.lttng.ui.views.resources.evProcessor;
14
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.internal.lttng.ui.TraceDebug;
20 import org.eclipse.linuxtools.internal.lttng.ui.model.trange.TimeRangeEventResource;
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 @Override
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;
43
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;
48 }
49
50 TraceDebug.debug("Number of localResources: " //$NON-NLS-1$
51 + resContainer.readItems().length);
52
53 // for each existing resource
54 for (TimeRangeEventResource localResource : resContainer
55 .readItems()) {
56
57 // get the start time
58 long stime = localResource.getNext_good_time();
59
60 // Get the resource state mode
61 String stateMode = localResource.getStateMode(traceSt);
62
63 // Insert an instance from previous time to end request time with
64 // the current state
65 makeDraw(traceSt, stime, endOfEvent, localResource, params, stateMode);
66 }
67
68 return false;
69 }
70
71 }
This page took 0.034042 seconds and 5 git commands to generate.