1 /*******************************************************************************
2 * Copyright (c) 2011 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 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.latency
.model
;
15 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.LttngConstants
;
16 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.event
.LttngEvent
;
17 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.latency
.analyzer
.EventMatcher
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfDataRequest
;
20 import org
.eclipse
.linuxtools
.tmf
.core
.request
.TmfEventRequest
;
23 * <b><u>LatencyEventRequest</u></b>
26 public class LatencyEventRequest
extends TmfEventRequest
<LttngEvent
> {
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
31 final private LatencyController fController
;
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 public LatencyEventRequest(LatencyController controller
, TmfTimeRange range
, int rank
, int nbEvents
, ITmfDataRequest
.ExecutionType execType
) {
38 super(LttngEvent
.class, range
, rank
, nbEvents
, LttngConstants
.DEFAULT_BLOCK_SIZE
, execType
);
39 fController
= controller
;
40 EventMatcher
.getInstance().clearStack();
43 public LatencyEventRequest(LatencyController controller
, TmfTimeRange range
, ITmfDataRequest
.ExecutionType execType
) {
44 this(controller
, range
, 0, ALL_DATA
, execType
);
47 public LatencyEventRequest(LatencyController controller
, TmfTimeRange range
, int rank
, ITmfDataRequest
.ExecutionType execType
) {
48 this(controller
, range
, rank
, ALL_DATA
, execType
);
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
57 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.event.TmfData)
60 public void handleData(LttngEvent event
) {
61 super.handleData(event
);
63 LttngEvent startEvent
= EventMatcher
.getInstance().process(event
);
65 if (startEvent
!= null) {
66 long latency
= event
.getTimestamp().getValue() - startEvent
.getTimestamp().getValue();
67 fController
.handleData(getNbRead(), startEvent
.getTimestamp().getValue(), latency
);
73 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCompleted()
76 public void handleCompleted() {
77 fController
.handleCompleted();
78 super.handleCompleted();
83 * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCancel()
86 public void handleCancel() {
87 EventMatcher
.getInstance().clearStack();
88 fController
.handleCancel();