Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2010 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.request; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.event.LttngEvent; | |
15 | import org.eclipse.linuxtools.lttng.state.model.LttngTraceState; | |
16 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; | |
17 | import org.eclipse.linuxtools.tmf.event.TmfTimestamp; | |
18 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; | |
550d787e | 19 | import org.eclipse.linuxtools.tmf.request.ITmfDataRequest; |
5d10d135 ASL |
20 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; |
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 | |
26 | * | |
27 | * @author alvaro | |
28 | * | |
29 | */ | |
30 | public abstract class LttngBaseEventRequest extends TmfEventRequest<LttngEvent> { | |
31 | ||
32 | // ======================================================================== | |
33 | // Data | |
34 | // ======================================================================= | |
35 | private long numOfEvents = 0; | |
36 | private boolean clearDataInd = false; | |
37 | private final LttngTraceState ftraceModel; | |
38 | /** | |
39 | * The time to send events to the application as requested, Note: The start | |
40 | * time of the request for base events is adjusted to the nearest check | |
41 | * point | |
42 | */ | |
43 | private final TmfTimestamp fDispatchTime; | |
44 | ||
45 | // ======================================================================== | |
46 | // Constructors | |
47 | // ======================================================================= | |
48 | /** | |
49 | * @param range | |
50 | * @param dispatchTime | |
51 | * @param offset | |
52 | * @param nbEvents | |
53 | * @param maxBlockSize | |
54 | * @param traceModel | |
55 | * @param listener | |
56 | */ | |
57 | public LttngBaseEventRequest(TmfTimeRange range, TmfTimestamp dispatchTime, | |
58 | long offset, int nbEvents, int maxBlockSize, | |
550d787e FC |
59 | LttngTraceState traceModel, ITmfDataRequest.ExecutionType execType) { |
60 | super(LttngEvent.class, range, nbEvents, maxBlockSize, execType); | |
5d10d135 ASL |
61 | ftraceModel = traceModel; |
62 | fDispatchTime = dispatchTime; | |
63 | } | |
64 | ||
cb866e08 FC |
65 | @Override |
66 | public void cancel() { | |
67 | super.cancel(); | |
68 | } | |
69 | ||
5d10d135 ASL |
70 | // ======================================================================== |
71 | // Methods | |
72 | // ======================================================================= | |
73 | ||
74 | /** | |
75 | * Trigger the start to process this request right after the notification to | |
76 | * the interested listeners | |
77 | * | |
78 | * @param experiment | |
79 | * @param broadcast | |
80 | * true: All views, false: only to registered listeners | |
81 | */ | |
82 | public void startRequestInd(TmfExperiment<LttngEvent> experiment, | |
83 | boolean broadcast) { | |
84 | // trigger the start to process this request | |
85 | experiment.sendRequest(this); | |
86 | } | |
87 | ||
88 | /** | |
89 | * @param numOfEvents | |
90 | * the numOfEvents to set | |
91 | */ | |
92 | public void setNumOfEvents(long numOfEvents) { | |
93 | this.numOfEvents = numOfEvents; | |
94 | } | |
95 | ||
96 | /** | |
97 | * @return the numOfEvents | |
98 | */ | |
99 | public long getNumOfEvents() { | |
100 | return numOfEvents; | |
101 | } | |
102 | ||
103 | /** | |
104 | * @param clearAllData | |
105 | * indicates the need to clear all previous data e.g. a new | |
106 | * experiment selection | |
107 | */ | |
108 | public void setclearDataInd(boolean clearAllData) { | |
109 | this.clearDataInd = clearAllData; | |
110 | } | |
111 | ||
112 | /** | |
113 | * Returns indication - clearing of all existing data model is required e.g | |
114 | * from the selection of a new experiment | |
115 | * | |
116 | * @return | |
117 | */ | |
118 | public boolean isclearDataInd() { | |
119 | return clearDataInd; | |
120 | } | |
121 | ||
122 | /** | |
123 | * @return the ftraceModel, Trace state-data-model associated to this event | |
124 | */ | |
125 | public LttngTraceState getTraceModel() { | |
126 | return ftraceModel; | |
127 | } | |
128 | ||
129 | /** | |
130 | * @return The time to start dispatching events to the application | |
131 | */ | |
132 | public TmfTimestamp getDispatchTime() { | |
133 | return fDispatchTime; | |
134 | } | |
135 | } |