lttng: Update @since annotations for 3.0
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / HistogramRequest.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 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 * William Bourque - Initial API and implementation
11 * Yuriy Vashchuk - Heritage correction.
12 * Francois Chouinard - Cleanup and refactoring
13 * Francois Chouinard - Moved from LTTng to TMF
14 * Simon Delisle - Added a new parameter to the constructor
15 *******************************************************************************/
16
17 package org.eclipse.linuxtools.tmf.ui.views.histogram;
18
19 import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
20 import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
21 import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
22 import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
23 import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
24 import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
25
26 /**
27 * Class to request events for given time range from a trace to fill a
28 * HistogramDataModel and HistogramView.
29 *
30 * @version 1.0
31 * @author Francois Chouinard
32 * <p>
33 */
34 public class HistogramRequest extends TmfEventRequest {
35
36 // ------------------------------------------------------------------------
37 // Attributes
38 // ------------------------------------------------------------------------
39
40 /**
41 * The histogram data model to fill.
42 */
43 protected final HistogramDataModel fHistogram;
44
45 private final boolean fFullRange;
46
47 // ------------------------------------------------------------------------
48 // Constructor
49 // ------------------------------------------------------------------------
50
51 /**
52 * Constructor
53 *
54 * @param histogram
55 * The histogram data model
56 * @param range
57 * The time range to request data
58 * @param rank
59 * The index of the first event to retrieve
60 * @param nbEvents
61 * The number of events requested
62 * @param blockSize
63 * The number of events per block
64 * @param execType
65 * The requested execution priority
66 * @since 3.0
67 *
68 */
69 @Deprecated
70 public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
71 int rank, int nbEvents, int blockSize,
72 ITmfEventRequest.ExecutionType execType) {
73 super(ITmfEvent.class, range, rank, nbEvents, execType);
74 fHistogram = histogram;
75 if (execType == ExecutionType.FOREGROUND) {
76 fFullRange = false;
77 } else {
78 fFullRange = true;
79 }
80 }
81
82 /**
83 * Constructor
84 *
85 * @param histogram
86 * The histogram data model
87 * @param range
88 * The time range to request data
89 * @param rank
90 * The index of the first event to retrieve
91 * @param nbEvents
92 * The number of events requested
93 * @param blockSize
94 * The number of events per block
95 * @param execType
96 * The requested execution priority
97 * @param fullRange
98 * Full range or time range for histogram request
99 * @since 3.0
100 *
101 */
102 public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
103 int rank, int nbEvents, int blockSize,
104 ITmfEventRequest.ExecutionType execType, boolean fullRange) {
105 super(ITmfEvent.class, range, rank, nbEvents, execType);
106 fHistogram = histogram;
107 fFullRange = fullRange;
108 }
109
110 // ------------------------------------------------------------------------
111 // TmfEventRequest
112 // ------------------------------------------------------------------------
113
114 /**
115 * Handle the event from the trace by updating the histogram data model.
116 *
117 * @param event
118 * a event from the trace
119 * @see org.eclipse.linuxtools.tmf.core.request.TmfEventRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent)
120 */
121 @Override
122 public void handleData(ITmfEvent event) {
123 super.handleData(event);
124 if (event != null) {
125 if (event instanceof ITmfLostEvent) {
126 ITmfLostEvent lostEvents = (ITmfLostEvent) event;
127 /* clear the old data when it is a new request */
128 fHistogram.countLostEvent(lostEvents.getTimeRange(), lostEvents.getNbLostEvents(), fFullRange);
129
130 } else { /* handle lost event */
131 long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
132 fHistogram.countEvent(getNbRead(), timestamp);
133 }
134 }
135 }
136
137 /**
138 * Complete the request. It also notifies the histogram model about the
139 * completion.
140 *
141 * @see org.eclipse.linuxtools.tmf.core.request.TmfEventRequest#handleCompleted()
142 */
143 @Override
144 public void handleCompleted() {
145 fHistogram.complete();
146 super.handleCompleted();
147 }
148 }
This page took 0.038986 seconds and 5 git commands to generate.