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 | ||
65 | // ======================================================================== | |
66 | // Methods | |
67 | // ======================================================================= | |
68 | ||
69 | /** | |
70 | * Trigger the start to process this request right after the notification to | |
71 | * the interested listeners | |
72 | * | |
73 | * @param experiment | |
74 | * @param broadcast | |
75 | * true: All views, false: only to registered listeners | |
76 | */ | |
77 | public void startRequestInd(TmfExperiment<LttngEvent> experiment, | |
78 | boolean broadcast) { | |
79 | // trigger the start to process this request | |
80 | experiment.sendRequest(this); | |
81 | } | |
82 | ||
83 | /** | |
84 | * @param numOfEvents | |
85 | * the numOfEvents to set | |
86 | */ | |
87 | public void setNumOfEvents(long numOfEvents) { | |
88 | this.numOfEvents = numOfEvents; | |
89 | } | |
90 | ||
91 | /** | |
92 | * @return the numOfEvents | |
93 | */ | |
94 | public long getNumOfEvents() { | |
95 | return numOfEvents; | |
96 | } | |
97 | ||
98 | /** | |
99 | * @param clearAllData | |
100 | * indicates the need to clear all previous data e.g. a new | |
101 | * experiment selection | |
102 | */ | |
103 | public void setclearDataInd(boolean clearAllData) { | |
104 | this.clearDataInd = clearAllData; | |
105 | } | |
106 | ||
107 | /** | |
108 | * Returns indication - clearing of all existing data model is required e.g | |
109 | * from the selection of a new experiment | |
110 | * | |
111 | * @return | |
112 | */ | |
113 | public boolean isclearDataInd() { | |
114 | return clearDataInd; | |
115 | } | |
116 | ||
117 | /** | |
118 | * @return the ftraceModel, Trace state-data-model associated to this event | |
119 | */ | |
120 | public LttngTraceState getTraceModel() { | |
121 | return ftraceModel; | |
122 | } | |
123 | ||
124 | /** | |
125 | * @return The time to start dispatching events to the application | |
126 | */ | |
127 | public TmfTimestamp getDispatchTime() { | |
128 | return fDispatchTime; | |
129 | } | |
130 | } |