1 /*******************************************************************************
2 * Copyright (c) 2009, 2011, 2012 Ericsson
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
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 *******************************************************************************/
16 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.histogram
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfDataRequest
;
21 import org
.eclipse
.linuxtools
.tmf
.core
.request
.TmfEventRequest
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfTrace
;
25 * <b><u>HistogramRequest</u></b>
28 public class HistogramRequest
extends TmfEventRequest
<ITmfEvent
> {
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 protected final HistogramDataModel fHistogram
;
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 public HistogramRequest(HistogramDataModel histogram
, TmfTimeRange range
, int rank
, int nbEvents
, ITmfDataRequest
.ExecutionType execType
) {
41 super(ITmfEvent
.class, range
, rank
, nbEvents
, TmfTrace
.DEFAULT_TRACE_CACHE_SIZE
, execType
);
42 fHistogram
= histogram
;
45 public HistogramRequest(HistogramDataModel histogram
, TmfTimeRange range
, ITmfDataRequest
.ExecutionType execType
) {
46 this(histogram
, range
, 0, ALL_DATA
, execType
);
49 public HistogramRequest(HistogramDataModel histogram
, TmfTimeRange range
, int rank
, ITmfDataRequest
.ExecutionType execType
) {
50 this(histogram
, range
, rank
, ALL_DATA
, execType
);
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
58 public void handleData(ITmfEvent event
) {
59 super.handleData(event
);
61 long timestamp
= event
.getTimestamp().getValue();
62 fHistogram
.countEvent(getNbRead(), timestamp
);
67 public void handleCompleted() {
68 fHistogram
.complete();
69 super.handleCompleted();
73 public void handleCancel() {