From 527225f5d87e81263ff40e03f0fe1b4a5313bf13 Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Fri, 8 Jun 2012 11:38:19 -0400 Subject: [PATCH] Fix for bug382121 (traceLibPath usage when opening a legacy LTTng trace) --- .../internal/lttng/core/trace/LTTngTrace.java | 103 +----------------- 1 file changed, 2 insertions(+), 101 deletions(-) diff --git a/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java b/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java index 25e39ff4b8..65e30e5829 100644 --- a/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java +++ b/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java @@ -128,6 +128,8 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< protected synchronized void initialize(final IResource resource, final String path, final Class eventType) throws TmfTraceException { try { + IProject project = resource.getProject(); + traceLibPath = (project != null) ? TraceHelper.getTraceLibDirFromProject(project) : null; currentJniTrace = JniTraceFactory.getJniTrace(path, traceLibPath, SHOW_LTT_DEBUG_DEFAULT); } catch (final Exception e) { throw new TmfTraceException(e.getMessage()); @@ -158,15 +160,6 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< setParser((ITmfEventParser) this); setCacheSize(CHECKPOINT_PAGE_SIZE); - // // Bypass indexing if asked - // if ( bypassIndexing == false ) { - // indexTrace(true); - // } - // else { - // Even if we don't have any index, set ONE checkpoint - // fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L) , new - // LttngLocation() ) ); - initializeStreamingMonitor(); } @@ -312,50 +305,9 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< */ public LTTngTrace(final LTTngTrace other) throws Exception { this(other.getResource(), other.getPath(), other.getTraceLibPath(), false, true); -// this.fCheckpoints = other.fCheckpoints; setTimeRange(new TmfTimeRange(new LttngTimestamp(other.getStartTime()), new LttngTimestamp(other.getEndTime()))); } - // @Override - // public synchronized LTTngTrace clone() { - // LTTngTrace clone = null; - // clone = (LTTngTrace) super.clone(); - // try { - // clone.currentJniTrace = JniTraceFactory.getJniTrace(getPath(), getTraceLibPath(), - // SHOW_LTT_DEBUG_DEFAULT); - // } catch (final JniException e) { - // // e.printStackTrace(); - // } - // - // // Export all the event types from the JNI side - // clone.traceTypes = new HashMap(); - // clone.traceTypeNames = new Vector(); - // clone.initialiseEventTypes(clone.currentJniTrace); - // - // // Verify that all those "default constructor" are safe to use - // clone.eventTimestamp = new LttngTimestamp(); - // clone.eventSource = ""; //$NON-NLS-1$ - // clone.eventType = new LttngEventType(); - // clone.eventContent = new LttngEventContent(clone.currentLttngEvent); - // clone.eventReference = getName(); - // - // // Create the skeleton event - // clone.currentLttngEvent = new LttngEvent(this, clone.eventTimestamp, clone.eventSource, clone.eventType, - // clone.eventContent, clone.eventReference, null); - // - // // Create a new current location - // clone.previousLocation = new LttngLocation(); - // - // // Set the currentEvent to the eventContent - // clone.eventContent.setEvent(clone.currentLttngEvent); - // - // // Set the start time of the trace - // setTimeRange(new TmfTimeRange(new LttngTimestamp(clone.currentJniTrace.getStartTime().getTime()), - // new LttngTimestamp(clone.currentJniTrace.getEndTime().getTime()))); - // - // return clone; - // } - public String getTraceLibPath() { return traceLibPath; } @@ -524,17 +476,6 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< if (PRINT_DEBUG) System.out.println("seekEvent(rank) rank -> " + rank); //$NON-NLS-1$ -// ITmfTimestamp timestamp = null; -// long index = rank / getCacheSize(); -// -// // Get the timestamp of the closest check point to the given position -// if (fCheckpoints.size() > 0) { -// if (index >= fCheckpoints.size()) -// index = fCheckpoints.size() - 1; -// timestamp = fCheckpoints.elementAt((int) index).getTimestamp(); -// } else -// timestamp = getStartTime(); - // Position the trace at the checkpoint final ITmfContext checkpointContext = getIndexer().seekIndex(rank); LttngLocation location = (LttngLocation) checkpointContext.getLocation(); @@ -675,27 +616,6 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< context.increaseRank(); } - // protected void updateIndex(TmfContext context, long rank, ITmfTimestamp timestamp) { - // - // if (getStartTime().compareTo(timestamp, false) > 0) - // setStartTime(timestamp); - // if (getEndTime().compareTo(timestamp, false) < 0) - // setEndTime(timestamp); - // if (rank != ITmfContext.UNKNOWN_RANK) { - // if (fNbEvents <= rank) - // fNbEvents = rank + 1; - // // Build the index as we go along - // if ((rank % fIndexPageSize) == 0) { - // // Determine the table position - // long position = rank / fIndexPageSize; - // // Add new entry at proper location (if empty) - // if (fCheckpoints.size() == position) { - // addCheckPoint(context, timestamp); - // } - // } - // } - // } - // this method was extracted for profiling purposes private synchronized LttngEvent readNextEvent(final LttngLocation curLocation) { LttngEvent returnedEvent; @@ -1015,25 +935,6 @@ public class LTTngTrace extends TmfTrace implements ITmfEventParser< return -1; } -// /** -// * Print the content of the checkpoint vector. -// *

-// * -// * This is intended for debug purpose only. -// */ -// public void printCheckpointsVector() { -// System.out.println("StartTime : " //$NON-NLS-1$ -// + getTimeRange().getStartTime().getValue()); -// System.out.println("EndTime : " //$NON-NLS-1$ -// + getTimeRange().getEndTime().getValue()); -// -// for (int pos = 0; pos < fCheckpoints.size(); pos++) { -// System.out.print(pos + ": " + "\t"); //$NON-NLS-1$ //$NON-NLS-2$ -// System.out.print(fCheckpoints.get(pos).getTimestamp() + "\t"); //$NON-NLS-1$ -// System.out.println(fCheckpoints.get(pos).getLocation()); -// } -// } - @Override public synchronized void dispose() { if (currentJniTrace != null) -- 2.34.1