tmf: Use tabs in statistics view for each traces
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / internal / lttng / ui / views / latency / model / LatencyEventRequest.java
CommitLineData
fbd124dd
BH
1/*******************************************************************************
2 * Copyright (c) 2011 Ericsson
0c32e4c5 3 *
fbd124dd
BH
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
0c32e4c5 8 *
fbd124dd
BH
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
12
638eac44 13package org.eclipse.linuxtools.internal.lttng.ui.views.latency.model;
fbd124dd 14
5945cec9
FC
15import org.eclipse.linuxtools.internal.lttng.core.LttngConstants;
16import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
17import org.eclipse.linuxtools.internal.lttng.core.latency.analyzer.EventMatcher;
0c32e4c5 18import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
fbd124dd
BH
19import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
20import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
21import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
22
23/**
24 * <b><u>LatencyEventRequest</u></b>
25 * <p>
26 */
0c32e4c5 27public class LatencyEventRequest extends TmfEventRequest {
fbd124dd
BH
28
29 // ------------------------------------------------------------------------
30 // Attributes
31 // ------------------------------------------------------------------------
32 final private LatencyController fController;
0c32e4c5 33
fbd124dd
BH
34 // ------------------------------------------------------------------------
35 // Constructor
36 // ------------------------------------------------------------------------
37
38 public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, int nbEvents, ITmfDataRequest.ExecutionType execType) {
39 super(LttngEvent.class, range, rank, nbEvents, LttngConstants.DEFAULT_BLOCK_SIZE, execType);
40 fController = controller;
41 EventMatcher.getInstance().clearStack();
42 }
43
44 public LatencyEventRequest(LatencyController controller, TmfTimeRange range, ITmfDataRequest.ExecutionType execType) {
45 this(controller, range, 0, ALL_DATA, execType);
46 }
47
48 public LatencyEventRequest(LatencyController controller, TmfTimeRange range, int rank, ITmfDataRequest.ExecutionType execType) {
49 this(controller, range, rank, ALL_DATA, execType);
50 }
51
52 // ------------------------------------------------------------------------
53 // Operations
54 // ------------------------------------------------------------------------
55
56 /*
57 * (non-Javadoc)
58 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.event.TmfData)
59 */
60 @Override
0c32e4c5 61 public void handleData(ITmfEvent event) {
fbd124dd 62 super.handleData(event);
0c32e4c5 63
fbd124dd
BH
64 LttngEvent startEvent = EventMatcher.getInstance().process(event);
65
66 if (startEvent != null) {
0c32e4c5 67 long latency = event.getTimestamp().getValue() - startEvent.getTimestamp().getValue();
fbd124dd
BH
68 fController.handleData(getNbRead(), startEvent.getTimestamp().getValue(), latency);
69 }
70 }
71
72 /*
73 * (non-Javadoc)
74 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCompleted()
75 */
76 @Override
77 public void handleCompleted() {
78 fController.handleCompleted();
79 super.handleCompleted();
80 }
81
82 /*
83 * (non-Javadoc)
84 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCancel()
85 */
86 @Override
87 public void handleCancel() {
88 EventMatcher.getInstance().clearStack();
89 fController.handleCancel();
90 super.handleCancel();
91 }
92}
This page took 0.031985 seconds and 5 git commands to generate.