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