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 | ||
14 | /** | |
15 | * CTF Packet descriptor, can come from a packet header or an index file, this | |
16 | * will show certain information about the packet such as the size and | |
17 | * timerange. | |
18 | * | |
19 | * @since 1.0 | |
20 | */ | |
21 | public interface ICTFPacketDescriptor { | |
22 | ||
23 | /** | |
24 | * Returns whether the packet includes (inclusively) the given timestamp in | |
25 | * the begin-end timestamp range. | |
26 | * | |
27 | * @param ts | |
28 | * The timestamp to check. | |
29 | * @return True if the packet includes the timestamp. | |
30 | */ | |
31 | boolean includes(long ts); | |
32 | ||
33 | /** | |
34 | * Gets the offset of a packet within a stream in bits | |
35 | * | |
36 | * @return the offset bits | |
37 | */ | |
38 | long getOffsetBits(); | |
39 | ||
40 | /** | |
41 | * Gets the size of the packet in bits. If you have a 1mb packet that is 499kb | |
42 | * used and the header is 1kb, this will return 1mb | |
43 | * | |
44 | * @return the packetSizeBits | |
45 | */ | |
46 | long getPacketSizeBits(); | |
47 | ||
48 | /** | |
49 | * Get the content size of the packet in bits. If you have a 1mb packet that is 499kb | |
50 | * used and the header is 1kb, this will return 500kb (used data + header | |
51 | * | |
52 | * @return the contentSizeBits | |
53 | */ | |
54 | long getContentSizeBits(); | |
55 | ||
56 | /** | |
57 | * Gets the beginning timestamp of the packet, all events within the packet will have timestamps after or at this time | |
58 | * | |
59 | * @return the timestampBegin | |
60 | */ | |
61 | long getTimestampBegin(); | |
62 | ||
63 | /** | |
64 | * Gets the ending timestamp of the packet, all events within the packet will have timestamps before or at this time | |
65 | * | |
66 | * @return the timestampEnd | |
67 | */ | |
68 | long getTimestampEnd(); | |
69 | ||
70 | /** | |
71 | * Gets the number of lost events in this packet | |
72 | * | |
73 | * @return the lostEvents in this packet | |
74 | */ | |
75 | long getLostEvents(); | |
76 | ||
77 | /** | |
78 | * Retrieve the value of an existing attribute | |
79 | * | |
80 | * @param field | |
81 | * The name of the attribute | |
82 | * @return The value that was stored, or null if it wasn't found | |
83 | */ | |
84 | Object lookupAttribute(String field); | |
85 | ||
86 | /** | |
87 | * Get the target of the packet (what device generated this packet) | |
88 | * | |
89 | * @return The target that is being traced | |
90 | */ | |
91 | String getTarget(); | |
92 | ||
93 | /** | |
94 | * Get the id of the target of the packet (a number helper) | |
95 | * | |
96 | * @return The ID of the target | |
97 | */ | |
98 | long getTargetId(); | |
99 | ||
100 | /** | |
101 | * Get the offset of the packet in bytes within the stream | |
102 | * | |
103 | * @return The offset of the packet in bytes | |
104 | */ | |
105 | long getOffsetBytes(); | |
106 | ||
107 | } |