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