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 | ||
8016d660 | 17 | import org.eclipse.linuxtools.lttng.LttngConstants; |
6e512b93 | 18 | import org.eclipse.linuxtools.lttng.event.LttngEvent; |
6e512b93 | 19 | import org.eclipse.linuxtools.tmf.event.TmfTimeRange; |
550d787e | 20 | import org.eclipse.linuxtools.tmf.request.ITmfDataRequest; |
6e512b93 ASL |
21 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; |
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 | ||
33 | private final Histogram fHistogram; | |
34 | ||
35 | // ------------------------------------------------------------------------ | |
36 | // Constructor | |
37 | // ------------------------------------------------------------------------ | |
38 | ||
39 | public HistogramRequest(Histogram histogram, TmfTimeRange range, int nbEvents, ITmfDataRequest.ExecutionType execType) { | |
40 | super(LttngEvent.class, range, nbEvents, LttngConstants.DEFAULT_BLOCK_SIZE, execType); | |
41 | fHistogram = histogram; | |
42 | } | |
43 | ||
44 | public HistogramRequest(Histogram histogram, TmfTimeRange range, ITmfDataRequest.ExecutionType execType) { | |
45 | this(histogram, range, ALL_DATA, execType); | |
6e512b93 | 46 | } |
f9673903 | 47 | |
c392540b FC |
48 | // ------------------------------------------------------------------------ |
49 | // TmfEventRequest | |
50 | // ------------------------------------------------------------------------ | |
51 | ||
52 | @Override | |
53 | public void handleData(LttngEvent event) { | |
54 | super.handleData(event); | |
cb866e08 | 55 | if (event != null) { |
c392540b FC |
56 | long timestamp = event.getTimestamp().getValue(); |
57 | fHistogram.countEvent(timestamp); | |
7ef9ae3f | 58 | } |
6e512b93 | 59 | } |
c392540b | 60 | |
6e512b93 ASL |
61 | @Override |
62 | public void handleCompleted() { | |
c392540b FC |
63 | fHistogram.refresh(); |
64 | super.handleCompleted(); | |
6e512b93 | 65 | } |
c392540b | 66 | |
6e512b93 ASL |
67 | @Override |
68 | public void handleCancel() { | |
c392540b FC |
69 | fHistogram.refresh(); |
70 | super.handleCancel(); | |
6e512b93 | 71 | } |
f05aabed | 72 | |
6e512b93 | 73 | } |