From 4f259636fd4667e8b1437996425758f99a2ebbaf Mon Sep 17 00:00:00 2001 From: William Bourque Date: Tue, 11 May 2010 20:17:58 +0000 Subject: [PATCH] Slight change to ease benchmarking --- .../linuxtools/lttng/trace/LTTngTrace.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java index 8ddef28776..04ee8728bc 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTrace.java @@ -513,7 +513,7 @@ public class LTTngTrace extends TmfTrace { // 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. @@ -732,7 +732,7 @@ public class LTTngTrace extends TmfTrace { return currentLttngEvent; } else { - return convertJniEventToTmfMultipleEventEvilFix(jniEvent); + return convertJniEventToTmfMultipleEventEvilFix(jniEvent, isParsingNeeded); } } @@ -745,7 +745,7 @@ public class LTTngTrace extends TmfTrace { * @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. @@ -761,8 +761,13 @@ public class LTTngTrace extends TmfTrace { 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; } -- 2.34.1