tmf: Remove deprecated methods/classes from tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / histogram / HistogramRequest.java
CommitLineData
378e7718 1/*******************************************************************************
576f0a4e 2 * Copyright (c) 2009, 2014 Ericsson
20ff3b75 3 *
378e7718
WB
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
20ff3b75 8 *
378e7718
WB
9 * Contributors:
10 * William Bourque - Initial API and implementation
c392540b
FC
11 * Yuriy Vashchuk - Heritage correction.
12 * Francois Chouinard - Cleanup and refactoring
e0752744 13 * Francois Chouinard - Moved from LTTng to TMF
95aa81ef 14 * Simon Delisle - Added a new parameter to the constructor
378e7718 15 *******************************************************************************/
c392540b 16
e0752744 17package org.eclipse.linuxtools.tmf.ui.views.histogram;
6e512b93 18
e0752744 19import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
95aa81ef 20import org.eclipse.linuxtools.tmf.core.event.ITmfLostEvent;
fd3f1eff 21import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
6c13869b 22import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
3bd46eef
AM
23import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
24import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
6e512b93 25
378e7718 26/**
95aa81ef
JCK
27 * Class to request events for given time range from a trace to fill a
28 * HistogramDataModel and HistogramView.
20ff3b75 29 *
b544077e
BH
30 * @version 1.0
31 * @author Francois Chouinard
95aa81ef 32 * <p>
378e7718 33 */
6256d8ad 34public class HistogramRequest extends TmfEventRequest {
c392540b
FC
35
36 // ------------------------------------------------------------------------
37 // Attributes
38 // ------------------------------------------------------------------------
39
b544077e
BH
40 /**
41 * The histogram data model to fill.
42 */
fbd124dd 43 protected final HistogramDataModel fHistogram;
c392540b 44
95aa81ef
JCK
45 private final boolean fFullRange;
46
c392540b
FC
47 // ------------------------------------------------------------------------
48 // Constructor
49 // ------------------------------------------------------------------------
50
95aa81ef
JCK
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 * @param fullRange
67 * Full range or time range for histogram request
c4767854 68 * @since 3.0
95aa81ef
JCK
69 */
70 public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
71 int rank, int nbEvents, int blockSize,
fd3f1eff 72 ITmfEventRequest.ExecutionType execType, boolean fullRange) {
5cc0453a 73 super(ITmfEvent.class, range, rank, nbEvents, execType);
95aa81ef
JCK
74 fHistogram = histogram;
75 fFullRange = fullRange;
c392540b
FC
76 }
77
c392540b
FC
78 // ------------------------------------------------------------------------
79 // TmfEventRequest
80 // ------------------------------------------------------------------------
20ff3b75 81
b544077e
BH
82 /**
83 * Handle the event from the trace by updating the histogram data model.
20ff3b75 84 *
95aa81ef
JCK
85 * @param event
86 * a event from the trace
fd3f1eff 87 * @see org.eclipse.linuxtools.tmf.core.request.TmfEventRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent)
b544077e 88 */
c392540b 89 @Override
e0752744 90 public void handleData(ITmfEvent event) {
c392540b 91 super.handleData(event);
cb866e08 92 if (event != null) {
95aa81ef
JCK
93 if (event instanceof ITmfLostEvent) {
94 ITmfLostEvent lostEvents = (ITmfLostEvent) event;
95 /* clear the old data when it is a new request */
96 fHistogram.countLostEvent(lostEvents.getTimeRange(), lostEvents.getNbLostEvents(), fFullRange);
97
98 } else { /* handle lost event */
99 long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
100 fHistogram.countEvent(getNbRead(), timestamp);
101 }
7ef9ae3f 102 }
6e512b93 103 }
c392540b 104
b544077e 105 /**
95aa81ef
JCK
106 * Complete the request. It also notifies the histogram model about the
107 * completion.
20ff3b75 108 *
fd3f1eff 109 * @see org.eclipse.linuxtools.tmf.core.request.TmfEventRequest#handleCompleted()
b544077e 110 */
6e512b93 111 @Override
5419a136 112 public void handleCompleted() {
fbd124dd 113 fHistogram.complete();
c392540b 114 super.handleCompleted();
6e512b93 115 }
6e512b93 116}
This page took 0.068917 seconds and 5 git commands to generate.