Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2010 Ericsson | |
0c32e4c5 | 3 | * |
5d10d135 ASL |
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 | |
0c32e4c5 | 8 | * |
5d10d135 ASL |
9 | * Contributors: |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
3f2b9283 | 11 | * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (first part) |
5d10d135 | 12 | *******************************************************************************/ |
5945cec9 | 13 | package org.eclipse.linuxtools.internal.lttng.core.request; |
5d10d135 | 14 | |
5945cec9 | 15 | import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent; |
4df4581d | 16 | import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; |
6c13869b | 17 | import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; |
6c13869b FC |
18 | import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; |
19 | import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest; | |
9e0640dc | 20 | import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment; |
5d10d135 ASL |
21 | |
22 | /** | |
23 | * This class is an extension of Tmf Event Request which includes specific | |
24 | * references i.e. a status listener to indicate the start and end of the | |
25 | * request | |
0c32e4c5 | 26 | * |
5d10d135 | 27 | * @author alvaro |
0c32e4c5 | 28 | * |
5d10d135 | 29 | */ |
0c32e4c5 | 30 | public abstract class LttngBaseEventRequest extends TmfEventRequest { |
5d10d135 ASL |
31 | |
32 | // ======================================================================== | |
33 | // Data | |
34 | // ======================================================================= | |
35 | private long numOfEvents = 0; | |
36 | private boolean clearDataInd = false; | |
5d10d135 ASL |
37 | /** |
38 | * The time to send events to the application as requested, Note: The start | |
39 | * time of the request for base events is adjusted to the nearest check | |
40 | * point | |
41 | */ | |
4df4581d | 42 | private final ITmfTimestamp fDispatchTime; |
5d10d135 ASL |
43 | |
44 | // ======================================================================== | |
45 | // Constructors | |
46 | // ======================================================================= | |
47 | /** | |
48 | * @param range | |
49 | * @param dispatchTime | |
50 | * @param offset | |
51 | * @param nbEvents | |
52 | * @param maxBlockSize | |
3f2b9283 | 53 | * @param traceState |
5d10d135 ASL |
54 | * @param listener |
55 | */ | |
4df4581d | 56 | public LttngBaseEventRequest(TmfTimeRange range, ITmfTimestamp dispatchTime, long offset, int nbEvents, |
3f2b9283 | 57 | int maxBlockSize, ITmfDataRequest.ExecutionType execType) { |
0c32e4c5 | 58 | super(LttngEvent.class, range, (int) offset, nbEvents, maxBlockSize, execType); |
5d10d135 ASL |
59 | fDispatchTime = dispatchTime; |
60 | } | |
61 | ||
cb866e08 FC |
62 | @Override |
63 | public void cancel() { | |
64 | super.cancel(); | |
65 | } | |
66 | ||
5d10d135 ASL |
67 | // ======================================================================== |
68 | // Methods | |
69 | // ======================================================================= | |
70 | ||
71 | /** | |
72 | * Trigger the start to process this request right after the notification to | |
73 | * the interested listeners | |
0c32e4c5 | 74 | * |
5d10d135 ASL |
75 | * @param experiment |
76 | * @param broadcast | |
77 | * true: All views, false: only to registered listeners | |
78 | */ | |
0c32e4c5 | 79 | public void startRequestInd(TmfExperiment experiment, |
5d10d135 ASL |
80 | boolean broadcast) { |
81 | // trigger the start to process this request | |
82 | experiment.sendRequest(this); | |
83 | } | |
84 | ||
85 | /** | |
86 | * @param numOfEvents | |
87 | * the numOfEvents to set | |
88 | */ | |
89 | public void setNumOfEvents(long numOfEvents) { | |
90 | this.numOfEvents = numOfEvents; | |
91 | } | |
92 | ||
93 | /** | |
94 | * @return the numOfEvents | |
95 | */ | |
96 | public long getNumOfEvents() { | |
97 | return numOfEvents; | |
98 | } | |
99 | ||
100 | /** | |
101 | * @param clearAllData | |
102 | * indicates the need to clear all previous data e.g. a new | |
103 | * experiment selection | |
104 | */ | |
105 | public void setclearDataInd(boolean clearAllData) { | |
106 | this.clearDataInd = clearAllData; | |
107 | } | |
108 | ||
109 | /** | |
110 | * Returns indication - clearing of all existing data model is required e.g | |
111 | * from the selection of a new experiment | |
0c32e4c5 | 112 | * |
5d10d135 ASL |
113 | * @return |
114 | */ | |
115 | public boolean isclearDataInd() { | |
116 | return clearDataInd; | |
117 | } | |
118 | ||
5d10d135 ASL |
119 | /** |
120 | * @return The time to start dispatching events to the application | |
121 | */ | |
4df4581d | 122 | public ITmfTimestamp getDispatchTime() { |
5d10d135 ASL |
123 | return fDispatchTime; |
124 | } | |
0c32e4c5 | 125 | |
5d10d135 | 126 | } |