Commit | Line | Data |
---|---|---|
378e7718 | 1 | /******************************************************************************* |
c392540b | 2 | * Copyright (c) 2009, 2011 Ericsson |
378e7718 WB |
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 | |
c392540b FC |
11 | * Yuriy Vashchuk - Heritage correction. |
12 | * Francois Chouinard - Cleanup and refactoring | |
378e7718 | 13 | *******************************************************************************/ |
c392540b | 14 | |
6e512b93 ASL |
15 | package org.eclipse.linuxtools.lttng.ui.views.histogram; |
16 | ||
6c13869b FC |
17 | import org.eclipse.linuxtools.lttng.core.LttngConstants; |
18 | import org.eclipse.linuxtools.lttng.core.event.LttngEvent; | |
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; | |
6e512b93 | 22 | |
378e7718 WB |
23 | /** |
24 | * <b><u>HistogramRequest</u></b> | |
25 | * <p> | |
378e7718 | 26 | */ |
6e512b93 | 27 | public class HistogramRequest extends TmfEventRequest<LttngEvent> { |
c392540b FC |
28 | |
29 | // ------------------------------------------------------------------------ | |
30 | // Attributes | |
31 | // ------------------------------------------------------------------------ | |
32 | ||
fbd124dd | 33 | protected final HistogramDataModel fHistogram; |
c392540b FC |
34 | |
35 | // ------------------------------------------------------------------------ | |
36 | // Constructor | |
37 | // ------------------------------------------------------------------------ | |
38 | ||
fbd124dd | 39 | public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, int rank, int nbEvents, ITmfDataRequest.ExecutionType execType) { |
74237cc3 | 40 | super(LttngEvent.class, range, rank, nbEvents, LttngConstants.DEFAULT_BLOCK_SIZE, execType); |
c392540b FC |
41 | fHistogram = histogram; |
42 | } | |
43 | ||
fbd124dd | 44 | public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, ITmfDataRequest.ExecutionType execType) { |
74237cc3 FC |
45 | this(histogram, range, 0, ALL_DATA, execType); |
46 | } | |
47 | ||
fbd124dd | 48 | public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, int rank, ITmfDataRequest.ExecutionType execType) { |
74237cc3 | 49 | this(histogram, range, rank, ALL_DATA, execType); |
6e512b93 | 50 | } |
f9673903 | 51 | |
c392540b FC |
52 | // ------------------------------------------------------------------------ |
53 | // TmfEventRequest | |
54 | // ------------------------------------------------------------------------ | |
55 | ||
56 | @Override | |
57 | public void handleData(LttngEvent event) { | |
58 | super.handleData(event); | |
cb866e08 | 59 | if (event != null) { |
c392540b | 60 | long timestamp = event.getTimestamp().getValue(); |
fbd124dd | 61 | fHistogram.countEvent(getNbRead(), timestamp); |
7ef9ae3f | 62 | } |
6e512b93 | 63 | } |
c392540b | 64 | |
6e512b93 ASL |
65 | @Override |
66 | public void handleCompleted() { | |
fbd124dd | 67 | fHistogram.complete(); |
c392540b | 68 | super.handleCompleted(); |
6e512b93 | 69 | } |
c392540b | 70 | |
6e512b93 ASL |
71 | @Override |
72 | public void handleCancel() { | |
fbd124dd | 73 | fHistogram.clear(); |
c392540b | 74 | super.handleCancel(); |
6e512b93 | 75 | } |
f05aabed | 76 | |
6e512b93 | 77 | } |