Commit | Line | Data |
---|---|---|
866e5b51 | 1 | /******************************************************************************* |
60ae41e1 | 2 | * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal and others |
866e5b51 FC |
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: Matthew Khouzam - Initial API and implementation | |
10 | * Contributors: Simon Marchi - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.ctf.core.trace; | |
13 | ||
14 | import java.io.IOException; | |
526c823c | 15 | import java.nio.ByteBuffer; |
866e5b51 | 16 | |
a4fa4e36 | 17 | import org.eclipse.jdt.annotation.NonNull; |
c26d0fe0 | 18 | import org.eclipse.linuxtools.ctf.core.CTFStrings; |
866e5b51 | 19 | import org.eclipse.linuxtools.ctf.core.event.EventDefinition; |
a4fa4e36 | 20 | import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration; |
486efb2e | 21 | import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer; |
a4fa4e36 MK |
22 | import org.eclipse.linuxtools.ctf.core.event.scope.IDefinitionScope; |
23 | import org.eclipse.linuxtools.ctf.core.event.scope.LexicalScope; | |
866e5b51 | 24 | import org.eclipse.linuxtools.ctf.core.event.types.Definition; |
a4fa4e36 | 25 | import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration; |
866e5b51 | 26 | import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition; |
21fb02fa | 27 | import org.eclipse.linuxtools.ctf.core.event.types.SimpleDatatypeDefinition; |
866e5b51 FC |
28 | import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration; |
29 | import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition; | |
30 | import org.eclipse.linuxtools.ctf.core.event.types.VariantDefinition; | |
8e964be1 | 31 | import org.eclipse.linuxtools.internal.ctf.core.event.EventDeclaration; |
ce2388e0 | 32 | import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndexEntry; |
866e5b51 | 33 | |
a4fa4e36 MK |
34 | import com.google.common.collect.ImmutableList; |
35 | ||
866e5b51 | 36 | /** |
d37aaa7f | 37 | * CTF trace packet reader. Reads the events of a packet of a trace file. |
5c7202b5 | 38 | * |
d37aaa7f FC |
39 | * @author Matthew Khouzam |
40 | * @author Simon Marchi | |
d84419e1 | 41 | * @since 3.0 |
866e5b51 | 42 | */ |
d84419e1 | 43 | public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseable { |
866e5b51 FC |
44 | |
45 | // ------------------------------------------------------------------------ | |
6bdc9fac | 46 | // Attributes |
866e5b51 FC |
47 | // ------------------------------------------------------------------------ |
48 | ||
6bdc9fac | 49 | /** BitBuffer used to read the trace file. */ |
a4fa4e36 | 50 | @NonNull |
2882273c | 51 | private final BitBuffer fBitBuffer; |
866e5b51 | 52 | |
6bdc9fac | 53 | /** StreamInputReader that uses this StreamInputPacketReader. */ |
d84419e1 | 54 | private final CTFStreamInputReader fStreamInputReader; |
866e5b51 | 55 | |
6bdc9fac | 56 | /** Trace packet header. */ |
a4fa4e36 | 57 | private final StructDeclaration fTracePacketHeaderDecl; |
866e5b51 | 58 | |
6bdc9fac | 59 | /** Stream packet context definition. */ |
a4fa4e36 | 60 | private final StructDeclaration fStreamPacketContextDecl; |
866e5b51 | 61 | |
6bdc9fac | 62 | /** Stream event header definition. */ |
a4fa4e36 | 63 | private final StructDeclaration fStreamEventHeaderDecl; |
866e5b51 | 64 | |
c26d0fe0 | 65 | /** Stream event context definition. */ |
a4fa4e36 | 66 | private final StructDeclaration fStreamEventContextDecl; |
866e5b51 | 67 | |
a4fa4e36 MK |
68 | private StructDefinition fCurrentTracePacketHeaderDef; |
69 | private StructDefinition fCurrentStreamEventHeaderDef; | |
70 | private Definition fCurrentStreamPacketContextDef; | |
6bdc9fac | 71 | /** Reference to the index entry of the current packet. */ |
2882273c | 72 | private StreamInputPacketIndexEntry fCurrentPacket = null; |
6bdc9fac | 73 | |
866e5b51 | 74 | /** |
6bdc9fac AM |
75 | * Last timestamp recorded. |
76 | * | |
77 | * Needed to calculate the complete timestamp values for the events with | |
78 | * compact headers. | |
866e5b51 | 79 | */ |
2882273c | 80 | private long fLastTimestamp = 0; |
6bdc9fac AM |
81 | |
82 | /** CPU id of current packet. */ | |
2882273c | 83 | private int fCurrentCpu = 0; |
866e5b51 | 84 | |
2882273c | 85 | private int fLostEventsInThisPacket; |
5c7202b5 | 86 | |
2882273c | 87 | private long fLostEventsDuration; |
c26d0fe0 | 88 | |
2882273c | 89 | private boolean fHasLost = false; |
c26d0fe0 | 90 | |
866e5b51 | 91 | // ------------------------------------------------------------------------ |
6bdc9fac | 92 | // Constructors |
866e5b51 FC |
93 | // ------------------------------------------------------------------------ |
94 | ||
95 | /** | |
96 | * Constructs a StreamInputPacketReader. | |
97 | * | |
98 | * @param streamInputReader | |
99 | * The StreamInputReader to which this packet reader belongs to. | |
100 | */ | |
d84419e1 | 101 | public CTFStreamInputPacketReader(CTFStreamInputReader streamInputReader) { |
2882273c | 102 | fStreamInputReader = streamInputReader; |
866e5b51 | 103 | |
6bdc9fac | 104 | /* Set the BitBuffer's byte order. */ |
2882273c MK |
105 | fBitBuffer = new BitBuffer(); |
106 | fBitBuffer.setByteOrder(streamInputReader.getByteOrder()); | |
33656d8e | 107 | |
d84419e1 | 108 | final CTFStream currentStream = streamInputReader.getStreamInput().getStream(); |
a4fa4e36 MK |
109 | fTracePacketHeaderDecl = currentStream.getTrace().getPacketHeader(); |
110 | fStreamPacketContextDecl = currentStream.getPacketContextDecl(); | |
111 | fStreamEventHeaderDecl = currentStream.getEventHeaderDecl(); | |
112 | fStreamEventContextDecl = currentStream.getEventContextDecl(); | |
113 | } | |
6bdc9fac | 114 | |
a4fa4e36 MK |
115 | /** |
116 | * Get the event context defintiion | |
117 | * | |
118 | * @param input | |
119 | * the bitbuffer to read from | |
120 | * @return an context definition, can be null | |
121 | * @throws CTFReaderException | |
122 | * out of bounds exception or such | |
a4fa4e36 MK |
123 | */ |
124 | public StructDefinition getEventContextDefinition(@NonNull BitBuffer input) throws CTFReaderException { | |
125 | return fStreamEventContextDecl.createDefinition(this, LexicalScope.STREAM_EVENT_CONTEXT.getName(), input); | |
126 | } | |
6bdc9fac | 127 | |
a4fa4e36 MK |
128 | /** |
129 | * Get the stream context defintiion | |
130 | * | |
131 | * @param input | |
132 | * the bitbuffer to read from | |
133 | * @return an context definition, can be null | |
134 | * @throws CTFReaderException | |
135 | * out of bounds exception or such | |
a4fa4e36 MK |
136 | */ |
137 | public StructDefinition getStreamEventHeaderDefinition(@NonNull BitBuffer input) throws CTFReaderException { | |
138 | return fStreamEventHeaderDecl.createDefinition(this, LexicalScope.STREAM_EVENT_HEADER.getName(), input); | |
139 | } | |
6bdc9fac | 140 | |
a4fa4e36 MK |
141 | /** |
142 | * Get the packet context defintiion | |
143 | * | |
144 | * @param input | |
145 | * the bitbuffer to read from | |
146 | * @return an context definition, can be null | |
147 | * @throws CTFReaderException | |
148 | * out of bounds exception or such | |
a4fa4e36 MK |
149 | */ |
150 | public StructDefinition getStreamPacketContextDefinition(@NonNull BitBuffer input) throws CTFReaderException { | |
151 | return fStreamPacketContextDecl.createDefinition(this, LexicalScope.STREAM_PACKET_CONTEXT.getName(), input); | |
152 | } | |
6bdc9fac | 153 | |
a4fa4e36 MK |
154 | /** |
155 | * Get the event header defintiion | |
156 | * | |
157 | * @param input | |
158 | * the bitbuffer to read from | |
159 | * @return an header definition, can be null | |
160 | * @throws CTFReaderException | |
161 | * out of bounds exception or such | |
a4fa4e36 MK |
162 | */ |
163 | public StructDefinition getTracePacketHeaderDefinition(@NonNull BitBuffer input) throws CTFReaderException { | |
164 | return fTracePacketHeaderDecl.createDefinition(this, LexicalScope.TRACE_PACKET_HEADER.getName(), input); | |
6bdc9fac | 165 | } |
866e5b51 | 166 | |
5d1c6919 PT |
167 | /** |
168 | * Dispose the StreamInputPacketReader | |
5d1c6919 | 169 | */ |
dd9752d5 AM |
170 | @Override |
171 | public void close() { | |
2882273c | 172 | fBitBuffer.setByteBuffer(null); |
5d1c6919 PT |
173 | } |
174 | ||
866e5b51 FC |
175 | // ------------------------------------------------------------------------ |
176 | // Getters/Setters/Predicates | |
177 | // ------------------------------------------------------------------------ | |
178 | ||
9ac2eb62 MK |
179 | /** |
180 | * Gets the current packet | |
181 | * | |
182 | * @return the current packet | |
183 | */ | |
486efb2e | 184 | StreamInputPacketIndexEntry getCurrentPacket() { |
2882273c | 185 | return fCurrentPacket; |
866e5b51 FC |
186 | } |
187 | ||
9ac2eb62 MK |
188 | /** |
189 | * Gets the CPU (core) number | |
190 | * | |
191 | * @return the CPU (core) number | |
192 | */ | |
866e5b51 | 193 | public int getCPU() { |
2882273c | 194 | return fCurrentCpu; |
866e5b51 FC |
195 | } |
196 | ||
197 | @Override | |
a4fa4e36 MK |
198 | public LexicalScope getScopePath() { |
199 | return LexicalScope.PACKET; | |
866e5b51 FC |
200 | } |
201 | ||
202 | // ------------------------------------------------------------------------ | |
203 | // Operations | |
204 | // ------------------------------------------------------------------------ | |
205 | ||
866e5b51 FC |
206 | /** |
207 | * Changes the current packet to the given one. | |
208 | * | |
209 | * @param currentPacket | |
210 | * The index entry of the packet to switch to. | |
db8e8f7d AM |
211 | * @throws CTFReaderException |
212 | * If we get an error reading the packet | |
866e5b51 | 213 | */ |
db8e8f7d | 214 | void setCurrentPacket(StreamInputPacketIndexEntry currentPacket) throws CTFReaderException { |
c26d0fe0 | 215 | StreamInputPacketIndexEntry prevPacket = null; |
2882273c | 216 | fCurrentPacket = currentPacket; |
866e5b51 | 217 | |
2882273c | 218 | if (fCurrentPacket != null) { |
866e5b51 FC |
219 | /* |
220 | * Change the map of the BitBuffer. | |
221 | */ | |
526c823c | 222 | ByteBuffer bb = null; |
866e5b51 | 223 | try { |
2882273c | 224 | bb = fStreamInputReader.getStreamInput().getByteBufferAt( |
a4fa4e36 MK |
225 | fCurrentPacket.getOffsetBytes(), |
226 | (fCurrentPacket.getPacketSizeBits() + 7) / 8); | |
866e5b51 | 227 | } catch (IOException e) { |
cf9a28da | 228 | throw new CTFReaderException(e.getMessage(), e); |
866e5b51 FC |
229 | } |
230 | ||
2882273c | 231 | fBitBuffer.setByteBuffer(bb); |
866e5b51 FC |
232 | |
233 | /* | |
234 | * Read trace packet header. | |
235 | */ | |
a4fa4e36 MK |
236 | if (fTracePacketHeaderDecl != null) { |
237 | fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(fBitBuffer); | |
866e5b51 FC |
238 | } |
239 | ||
240 | /* | |
241 | * Read stream packet context. | |
242 | */ | |
a4fa4e36 MK |
243 | if (fStreamPacketContextDecl != null) { |
244 | fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(fBitBuffer); | |
33656d8e | 245 | |
132a02b0 | 246 | /* Read CPU ID */ |
2882273c MK |
247 | if (getCurrentPacket().getTarget() != null) { |
248 | fCurrentCpu = (int) getCurrentPacket().getTargetId(); | |
866e5b51 | 249 | } |
21fb02fa | 250 | |
132a02b0 | 251 | /* Read number of lost events */ |
2882273c MK |
252 | fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); |
253 | if (fLostEventsInThisPacket != 0) { | |
254 | fHasLost = true; | |
c26d0fe0 AM |
255 | /* |
256 | * Compute the duration of the lost event time range. If the | |
257 | * current packet is the first packet, duration will be set | |
258 | * to 1. | |
259 | */ | |
260 | long lostEventsStartTime; | |
2882273c | 261 | int index = fStreamInputReader.getStreamInput().getIndex().getEntries().indexOf(currentPacket); |
c26d0fe0 AM |
262 | if (index == 0) { |
263 | lostEventsStartTime = currentPacket.getTimestampBegin() + 1; | |
264 | } else { | |
2882273c | 265 | prevPacket = fStreamInputReader.getStreamInput().getIndex().getEntries().get(index - 1); |
c26d0fe0 AM |
266 | lostEventsStartTime = prevPacket.getTimestampEnd(); |
267 | } | |
2882273c | 268 | fLostEventsDuration = Math.abs(lostEventsStartTime - currentPacket.getTimestampBegin()); |
c26d0fe0 | 269 | } |
866e5b51 FC |
270 | } |
271 | ||
272 | /* | |
273 | * Use the timestamp begin of the packet as the reference for the | |
274 | * timestamp reconstitution. | |
275 | */ | |
2882273c | 276 | fLastTimestamp = currentPacket.getTimestampBegin(); |
866e5b51 | 277 | } else { |
2882273c | 278 | fBitBuffer.setByteBuffer(null); |
866e5b51 | 279 | |
2882273c | 280 | fLastTimestamp = 0; |
866e5b51 FC |
281 | } |
282 | } | |
283 | ||
284 | /** | |
285 | * Returns whether it is possible to read any more events from this packet. | |
286 | * | |
287 | * @return True if it is possible to read any more events from this packet. | |
288 | */ | |
289 | public boolean hasMoreEvents() { | |
2882273c MK |
290 | if (fCurrentPacket != null) { |
291 | return fHasLost || (fBitBuffer.position() < fCurrentPacket.getContentSizeBits()); | |
866e5b51 FC |
292 | } |
293 | return false; | |
294 | } | |
295 | ||
296 | /** | |
297 | * Reads the next event of the packet into the right event definition. | |
298 | * | |
299 | * @return The event definition containing the event data that was just | |
300 | * read. | |
301 | * @throws CTFReaderException | |
be6df2d8 | 302 | * If there was a problem reading the trace |
866e5b51 FC |
303 | */ |
304 | public EventDefinition readNextEvent() throws CTFReaderException { | |
1fbaecd1 | 305 | /* Default values for those fields */ |
b73145e2 | 306 | long eventID = EventDeclaration.UNSET_EVENT_ID; |
866e5b51 | 307 | long timestamp = 0; |
2882273c MK |
308 | if (fHasLost) { |
309 | fHasLost = false; | |
a4fa4e36 MK |
310 | EventDeclaration lostEventDeclaration = EventDeclaration.getLostEventDeclaration(); |
311 | StructDeclaration lostFields = lostEventDeclaration.getFields(); | |
312 | // this is a hard coded map, we know it's not null | |
313 | IntegerDeclaration lostFieldsDecl = (IntegerDeclaration) lostFields.getFields().get(CTFStrings.LOST_EVENTS_FIELD); | |
314 | if (lostFieldsDecl == null) | |
315 | { | |
316 | throw new IllegalStateException("Lost events count not declared!"); //$NON-NLS-1$ | |
317 | } | |
318 | IntegerDeclaration lostEventsDurationDecl = (IntegerDeclaration) lostFields.getFields().get(CTFStrings.LOST_EVENTS_DURATION); | |
319 | if (lostEventsDurationDecl == null) { | |
320 | throw new IllegalStateException("Lost events duration not declared!"); //$NON-NLS-1$ | |
321 | } | |
322 | IntegerDefinition lostDurationDef = new IntegerDefinition(lostFieldsDecl, null, CTFStrings.LOST_EVENTS_DURATION, fLostEventsDuration); | |
323 | IntegerDefinition lostCountDef = new IntegerDefinition(lostEventsDurationDecl, null, CTFStrings.LOST_EVENTS_FIELD, fLostEventsInThisPacket); | |
324 | IntegerDefinition[] fields = new IntegerDefinition[] { lostCountDef, lostDurationDef }; | |
325 | /* this is weird notation, but it's the java notation */ | |
326 | final ImmutableList<String> fieldNameList = ImmutableList.<String> builder().add(CTFStrings.LOST_EVENTS_FIELD).add(CTFStrings.LOST_EVENTS_DURATION).build(); | |
327 | return new EventDefinition( | |
328 | lostEventDeclaration, | |
329 | fStreamInputReader, | |
330 | fLastTimestamp, | |
331 | null, | |
332 | null, | |
333 | null, | |
334 | new StructDefinition( | |
335 | lostFields, | |
336 | this, "fields", //$NON-NLS-1$ | |
337 | fieldNameList, | |
338 | fields | |
339 | )); | |
340 | ||
33656d8e | 341 | } |
132a02b0 | 342 | |
2882273c | 343 | final BitBuffer currentBitBuffer = fBitBuffer; |
cf9a28da | 344 | final long posStart = currentBitBuffer.position(); |
1fbaecd1 | 345 | /* Read the stream event header. */ |
a4fa4e36 MK |
346 | if (fStreamEventHeaderDecl != null) { |
347 | fCurrentStreamEventHeaderDef = getStreamEventHeaderDefinition(currentBitBuffer); | |
866e5b51 | 348 | |
1fbaecd1 | 349 | /* Check for the event id. */ |
a4fa4e36 | 350 | Definition idDef = fCurrentStreamEventHeaderDef.lookupDefinition("id"); //$NON-NLS-1$ |
1fbaecd1 AM |
351 | if (idDef instanceof SimpleDatatypeDefinition) { |
352 | eventID = ((SimpleDatatypeDefinition) idDef).getIntegerValue(); | |
b8cb28f6 | 353 | } else if (idDef != null) { |
816fde81 | 354 | throw new CTFReaderException("Incorrect event id : " + eventID); //$NON-NLS-1$ |
b8cb28f6 | 355 | } |
866e5b51 | 356 | |
c26d0fe0 AM |
357 | /* |
358 | * Get the timestamp from the event header (may be overridden later | |
359 | * on) | |
360 | */ | |
a4fa4e36 | 361 | IntegerDefinition timestampDef = fCurrentStreamEventHeaderDef.lookupInteger("timestamp"); //$NON-NLS-1$ |
0594c61c AM |
362 | if (timestampDef != null) { |
363 | timestamp = calculateTimestamp(timestampDef); | |
6bdc9fac | 364 | } // else timestamp remains 0 |
1fbaecd1 AM |
365 | |
366 | /* Check for the variant v. */ | |
a4fa4e36 | 367 | Definition variantDef = fCurrentStreamEventHeaderDef.lookupDefinition("v"); //$NON-NLS-1$ |
6bdc9fac | 368 | if (variantDef instanceof VariantDefinition) { |
866e5b51 | 369 | |
1fbaecd1 | 370 | /* Get the variant current field */ |
6bdc9fac | 371 | StructDefinition variantCurrentField = (StructDefinition) ((VariantDefinition) variantDef).getCurrentField(); |
866e5b51 | 372 | |
21fb02fa MK |
373 | /* |
374 | * Try to get the id field in the current field of the variant. | |
375 | * If it is present, it overrides the previously read event id. | |
376 | */ | |
6bdc9fac AM |
377 | Definition idIntegerDef = variantCurrentField.lookupDefinition("id"); //$NON-NLS-1$ |
378 | if (idIntegerDef instanceof IntegerDefinition) { | |
379 | eventID = ((IntegerDefinition) idIntegerDef).getValue(); | |
21fb02fa | 380 | } |
866e5b51 | 381 | |
c26d0fe0 AM |
382 | /* |
383 | * Get the timestamp. This would overwrite any previous | |
384 | * timestamp definition | |
385 | */ | |
0594c61c AM |
386 | Definition def = variantCurrentField.lookupDefinition("timestamp"); //$NON-NLS-1$ |
387 | if (def instanceof IntegerDefinition) { | |
388 | timestamp = calculateTimestamp((IntegerDefinition) def); | |
6bdc9fac | 389 | } |
21fb02fa | 390 | } |
866e5b51 FC |
391 | } |
392 | ||
1fbaecd1 | 393 | /* Get the right event definition using the event id. */ |
a4fa4e36 MK |
394 | IEventDeclaration eventDeclaration = fStreamInputReader.getStreamInput().getStream().getEvents().get(eventID); |
395 | if (eventDeclaration == null) { | |
866e5b51 FC |
396 | throw new CTFReaderException("Incorrect event id : " + eventID); //$NON-NLS-1$ |
397 | } | |
a4fa4e36 | 398 | EventDefinition eventDef = eventDeclaration.createDefinition(fStreamInputReader, fBitBuffer, timestamp); |
866e5b51 FC |
399 | |
400 | /* | |
401 | * Set the event timestamp using the timestamp calculated by | |
402 | * updateTimestamp. | |
403 | */ | |
866e5b51 | 404 | |
cf9a28da MK |
405 | if (posStart == currentBitBuffer.position()) { |
406 | throw new CTFReaderException("Empty event not allowed, event: " + eventDef.getDeclaration().getName()); //$NON-NLS-1$ | |
407 | } | |
408 | ||
866e5b51 FC |
409 | return eventDef; |
410 | } | |
411 | ||
412 | /** | |
413 | * Calculates the timestamp value of the event, possibly using the timestamp | |
414 | * from the last event. | |
415 | * | |
416 | * @param timestampDef | |
417 | * Integer definition of the timestamp. | |
418 | * @return The calculated timestamp value. | |
419 | */ | |
420 | private long calculateTimestamp(IntegerDefinition timestampDef) { | |
421 | long newval; | |
422 | long majorasbitmask; | |
423 | int len = timestampDef.getDeclaration().getLength(); | |
424 | ||
425 | /* | |
426 | * If the timestamp length is 64 bits, it is a full timestamp. | |
427 | */ | |
428 | if (timestampDef.getDeclaration().getLength() == 64) { | |
2882273c MK |
429 | fLastTimestamp = timestampDef.getValue(); |
430 | return fLastTimestamp; | |
866e5b51 FC |
431 | } |
432 | ||
433 | /* | |
434 | * Bit mask to keep / remove all old / new bits. | |
435 | */ | |
436 | majorasbitmask = (1L << len) - 1; | |
437 | ||
438 | /* | |
439 | * If the new value is smaller than the corresponding bits of the last | |
440 | * timestamp, we assume an overflow of the compact representation. | |
441 | */ | |
442 | newval = timestampDef.getValue(); | |
2882273c | 443 | if (newval < (fLastTimestamp & majorasbitmask)) { |
866e5b51 FC |
444 | newval = newval + (1L << len); |
445 | } | |
446 | ||
447 | /* Keep only the high bits of the old value */ | |
2882273c | 448 | fLastTimestamp = fLastTimestamp & ~majorasbitmask; |
866e5b51 FC |
449 | |
450 | /* Then add the low bits of the new value */ | |
2882273c | 451 | fLastTimestamp = fLastTimestamp + newval; |
866e5b51 | 452 | |
2882273c | 453 | return fLastTimestamp; |
866e5b51 FC |
454 | } |
455 | ||
456 | @Override | |
457 | public Definition lookupDefinition(String lookupPath) { | |
a4fa4e36 MK |
458 | if (lookupPath.equals(LexicalScope.STREAM_PACKET_CONTEXT)) { |
459 | return fCurrentStreamPacketContextDef; | |
460 | } | |
461 | if (lookupPath.equals(LexicalScope.TRACE_PACKET_HEADER)) { | |
462 | return fCurrentTracePacketHeaderDef; | |
463 | } | |
866e5b51 FC |
464 | return null; |
465 | } | |
a4fa4e36 MK |
466 | |
467 | /** | |
468 | * Get stream event header | |
469 | * | |
470 | * @return the stream event header | |
a4fa4e36 MK |
471 | */ |
472 | public StructDefinition getCurrentStreamEventHeader() { | |
473 | return fCurrentStreamEventHeaderDef; | |
474 | } | |
475 | ||
476 | /** | |
477 | * Get the current packet event header | |
478 | * | |
479 | * @return the current packet event header | |
a4fa4e36 MK |
480 | */ |
481 | public StructDefinition getCurrentPacketEventHeader() { | |
482 | return fCurrentTracePacketHeaderDef; | |
483 | } | |
866e5b51 | 484 | } |