// TMF assumes it is possible to read (GetNextEvent) to the next Event once ParseEvent() is called
// In LTTNG, there is not difference between "Parsing" and "Reading" an event.
// Since parsing/reading invalidate the previous event,
- // we need to make sure the sequenceParseEvent() -> GetNextEvent() will not actually move to the next event.
+ // we need to make sure the sequence ParseEvent() -> GetNextEvent() will not actually move to the next event.
// To do so, we avoid moving for call to "GetNextEvent()" that follow call to a call to "ParseEvent()".
// However, calling ParseEvent() -> GetNextEvent() -> GetNextEvent() will only move next by one.
return currentLttngEvent;
}
else {
- return convertJniEventToTmfMultipleEventEvilFix(jniEvent);
+ return convertJniEventToTmfMultipleEventEvilFix(jniEvent, isParsingNeeded);
}
}
* @param jniEvent The current JNI Event
* @return Current Lttng Event fully parsed
*/
- private synchronized LttngEvent convertJniEventToTmfMultipleEventEvilFix(JniEvent jniEvent) {
+ private synchronized LttngEvent convertJniEventToTmfMultipleEventEvilFix(JniEvent jniEvent, boolean isParsingNeeded) {
// *** HACK ***
// Below : the "fix" with all the new and the full-parse
// Allocating new memory is slow.
currentLttngEvent.updateJniEventReference(jniEvent);
// Ensure that the content is correctly set
eventContent.setEvent(currentLttngEvent);
- // FORCE the full parse of every event :
- eventContent.getFields();
+
+ // Parse the event if it was needed
+ // *** WARNING ***
+ // ONLY for testing, NOT parsing events with non-unique events WILL result in segfault in the JVM
+ if ( isParsingNeeded == true ) {
+ eventContent.getFields();
+ }
return currentLttngEvent;
}