Commit | Line | Data |
---|---|---|
c26d0fe0 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2013, 2014 Ericsson |
c26d0fe0 AM |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are made | |
5 | * 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 | * Alexandre Montplaisir - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
9722e5d7 | 13 | package org.eclipse.tracecompass.tmf.ctf.core.event; |
c26d0fe0 | 14 | |
a4fa4e36 | 15 | import org.eclipse.jdt.annotation.NonNull; |
f357bcd4 AM |
16 | import org.eclipse.tracecompass.ctf.core.event.EventDefinition; |
17 | import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; | |
2bdf0193 AM |
18 | import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent; |
19 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; | |
9722e5d7 AM |
20 | import org.eclipse.tracecompass.tmf.ctf.core.timestamp.CtfTmfTimestamp; |
21 | import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace; | |
c26d0fe0 AM |
22 | |
23 | /** | |
24 | * An implementation of {@link ITmfLostEvent} for use in the CTF adaptor. | |
25 | * | |
26 | * @author Alexandre Montplaisir | |
46a59db7 | 27 | * @since 2.2 |
c26d0fe0 AM |
28 | */ |
29 | public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent { | |
30 | ||
31 | private final TmfTimeRange fTimeRange; | |
32 | private final long fNbLost; | |
33 | ||
34 | /** | |
35 | * Constructor. Only {@link CtfTmfEventFactory} should call this. | |
36 | * | |
37 | * @param trace | |
38 | * The origin trace | |
39 | * @param rank | |
40 | * The rank of the event in the trace | |
41 | * @param content | |
42 | * The event's payload (fields). In case this event has some. | |
43 | * @param fileName | |
44 | * The name of the trace file from which this event comes | |
45 | * @param cpu | |
ecb12461 | 46 | * The CPU on which this event happened |
c26d0fe0 AM |
47 | * @param declaration |
48 | * The CTF Event Declaration object that created this event | |
49 | * @param timeRange | |
50 | * The time range of lost events indicated by this one | |
51 | * @param nbLost | |
52 | * The number of lost events in the range | |
53 | */ | |
54 | CtfTmfLostEvent(CtfTmfTrace trace, | |
55 | long rank, | |
c26d0fe0 AM |
56 | String fileName, |
57 | int cpu, | |
58 | IEventDeclaration declaration, | |
59 | TmfTimeRange timeRange, | |
a4fa4e36 MK |
60 | long nbLost, |
61 | @NonNull EventDefinition def) { | |
c26d0fe0 AM |
62 | /* |
63 | * Only the factory should call this method, the case to | |
64 | * (CtfTmfTimestamp) should be safe. | |
65 | */ | |
a4fa4e36 | 66 | super(trace, rank, (CtfTmfTimestamp) timeRange.getStartTime(), fileName, cpu, declaration, def); |
c26d0fe0 AM |
67 | fTimeRange = timeRange; |
68 | fNbLost = nbLost; | |
69 | } | |
70 | ||
71 | @Override | |
72 | public TmfTimeRange getTimeRange() { | |
73 | return fTimeRange; | |
74 | } | |
75 | ||
76 | @Override | |
77 | public long getNbLostEvents() { | |
78 | return fNbLost; | |
79 | } | |
80 | ||
c26d0fe0 | 81 | } |