Commit | Line | Data |
---|---|---|
1d92f045 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 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 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.tracecompass.ctf.core.trace; | |
13 | ||
28535426 MK |
14 | import java.util.Map; |
15 | ||
16 | import org.eclipse.jdt.annotation.NonNull; | |
17 | ||
1d92f045 MK |
18 | /** |
19 | * CTF Packet descriptor, can come from a packet header or an index file, this | |
20 | * will show certain information about the packet such as the size and | |
21 | * timerange. | |
22 | * | |
28535426 | 23 | * @since 2.0 |
1d92f045 MK |
24 | */ |
25 | public interface ICTFPacketDescriptor { | |
26 | ||
27 | /** | |
28 | * Returns whether the packet includes (inclusively) the given timestamp in | |
29 | * the begin-end timestamp range. | |
30 | * | |
31 | * @param ts | |
32 | * The timestamp to check. | |
33 | * @return True if the packet includes the timestamp. | |
34 | */ | |
35 | boolean includes(long ts); | |
36 | ||
37 | /** | |
38 | * Gets the offset of a packet within a stream in bits | |
39 | * | |
40 | * @return the offset bits | |
41 | */ | |
42 | long getOffsetBits(); | |
43 | ||
44 | /** | |
28535426 MK |
45 | * Gets the size of the packet in bits. If you have a 1mb packet that is |
46 | * 499kb used and the header is 1kb, this will return 1mb | |
1d92f045 MK |
47 | * |
48 | * @return the packetSizeBits | |
49 | */ | |
50 | long getPacketSizeBits(); | |
51 | ||
52 | /** | |
28535426 MK |
53 | * Get the content size of the packet in bits. If you have a 1mb packet that |
54 | * is 499kb used and the header is 1kb, this will return 500kb (used data + | |
55 | * header | |
1d92f045 MK |
56 | * |
57 | * @return the contentSizeBits | |
58 | */ | |
59 | long getContentSizeBits(); | |
60 | ||
61 | /** | |
28535426 MK |
62 | * Gets the beginning timestamp of the packet, all events within the packet |
63 | * will have timestamps after or at this time | |
1d92f045 MK |
64 | * |
65 | * @return the timestampBegin | |
66 | */ | |
67 | long getTimestampBegin(); | |
68 | ||
69 | /** | |
28535426 MK |
70 | * Gets the ending timestamp of the packet, all events within the packet |
71 | * will have timestamps before or at this time | |
1d92f045 MK |
72 | * |
73 | * @return the timestampEnd | |
74 | */ | |
75 | long getTimestampEnd(); | |
76 | ||
77 | /** | |
78 | * Gets the number of lost events in this packet | |
79 | * | |
80 | * @return the lostEvents in this packet | |
81 | */ | |
82 | long getLostEvents(); | |
83 | ||
84 | /** | |
28535426 | 85 | * Retrieve the map of the packet attributes |
1d92f045 | 86 | * |
28535426 MK |
87 | * @return The map of attributes stored. Example keys are "device" or |
88 | * "timestamp_begin" | |
89 | * @since 2.0 | |
1d92f045 | 90 | */ |
28535426 | 91 | @NonNull Map<String, Object> getAttributes(); |
1d92f045 MK |
92 | |
93 | /** | |
94 | * Get the target of the packet (what device generated this packet) | |
95 | * | |
96 | * @return The target that is being traced | |
97 | */ | |
98 | String getTarget(); | |
99 | ||
100 | /** | |
101 | * Get the id of the target of the packet (a number helper) | |
102 | * | |
103 | * @return The ID of the target | |
104 | */ | |
105 | long getTargetId(); | |
106 | ||
107 | /** | |
108 | * Get the offset of the packet in bytes within the stream | |
109 | * | |
110 | * @return The offset of the packet in bytes | |
111 | */ | |
112 | long getOffsetBytes(); | |
113 | ||
42f8feff MK |
114 | /** |
115 | * Get the offset where the events start and the packet header ends | |
116 | * | |
117 | * @return the offset in the file of the end of the packet header | |
118 | * @since 2.0 | |
119 | */ | |
120 | long getPayloadStartBits(); | |
121 | ||
1d92f045 | 122 | } |