1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.ctf
.core
.trace
;
16 * <b><u>StreamInputPacketIndexEntry</u></b>
18 * Represents an entry in the index of event packets.
20 public class StreamInputPacketIndexEntry
{
22 // ------------------------------------------------------------------------
24 // ------------------------------------------------------------------------
27 * Offset of the packet in the file, in bytes
29 public long offsetBytes
;
32 * Offset of the data in the packet, in bits
34 public int dataOffsetBits
= 0;
37 * Packet size, in bits
39 public int packetSizeBits
= 0;
42 * Content size, in bits
44 public int contentSizeBits
= 0;
49 public long timestampBegin
= 0;
54 public long timestampEnd
= 0;
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
61 * Constructs an index entry.
64 * The offset of the packet in the file, in bytes.
67 public StreamInputPacketIndexEntry(long offset
) {
68 this.offsetBytes
= offset
;
71 // ------------------------------------------------------------------------
73 // ------------------------------------------------------------------------
76 * Returns whether the packet includes (inclusively) the given timestamp in
77 * the begin-end timestamp range.
80 * The timestamp to check.
81 * @return True if the packet includes the timestamp.
83 boolean includes(long ts
) {
84 return (ts
>= timestampBegin
) && (ts
<= timestampEnd
);
88 public String
toString() {
89 /* Only for debugging, shouldn't be externalized */
90 return "PacketIndexEntry [offset=" + offsetBytes
+ ", timestampBegin=" //$NON-NLS-1$ //$NON-NLS-2$
91 + Long
.toHexString(timestampBegin
) + ',' + " timestampEnd=" //$NON-NLS-1$
92 + Long
.toHexString(timestampEnd
) + ", dataOffset=" //$NON-NLS-1$
93 + dataOffsetBits
+ ", packetSize=" + packetSizeBits
//$NON-NLS-1$
94 + ", contentSize=" + contentSizeBits
+ ']'; //$NON-NLS-1$