diff options
author | Francois Chouinard | 2012-04-20 23:05:53 +0000 |
---|---|---|
committer | Francois Chouinard | 2012-04-20 23:05:53 +0000 |
commit | 78c4d28d65f8e88228936625ef0a1646ab102d98 (patch) | |
tree | 69f3fc201c04b1f58c4e9a18c28c56d8ae3c637f /lttng/org.eclipse.linuxtools.lttng.core | |
parent | 6f78d5ee92bc3f93f44f26caea499ac0d8d8e36b (diff) | |
download | org.eclipse.linuxtools-78c4d28d65f8e88228936625ef0a1646ab102d98.tar.gz org.eclipse.linuxtools-78c4d28d65f8e88228936625ef0a1646ab102d98.tar.xz org.eclipse.linuxtools-78c4d28d65f8e88228936625ef0a1646ab102d98.zip |
Refactor TmfTrace and dependencies - finalize ITmfTraceIndexer
Diffstat (limited to 'lttng/org.eclipse.linuxtools.lttng.core')
2 files changed, 41 insertions, 34 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTextTrace.java b/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTextTrace.java index 13166d72dc..c757bc783e 100644 --- a/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTextTrace.java +++ b/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTextTrace.java @@ -27,7 +27,6 @@ import org.eclipse.linuxtools.lttng.jni.JniEvent; import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation; -import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint; import org.eclipse.linuxtools.tmf.core.trace.TmfContext; import org.eclipse.linuxtools.tmf.core.trace.TmfLocation; import org.eclipse.linuxtools.tmf.core.trace.TmfTrace; @@ -58,7 +57,7 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> { public LTTngTextTrace(final IResource resource, final String path, final boolean skipIndexing) throws Exception { // super(null, LttngEvent.class, path, 1, !skipIndexing); - super(null, LttngEvent.class, path, 1); + super(null, LttngEvent.class, path, 1000); tracepath = path; traceTypes = new HashMap<String, LttngEventType>(); @@ -75,11 +74,13 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> { if ( positionToFirstEvent() == false ) throw new IOException("Fail to position to the beginning of the trace"); //$NON-NLS-1$ else { - fCacheSize = 1000; +// fCacheSize = 1000; // Skip indexing if asked // if ( skipIndexing == true ) { - fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L), new TmfLocation<Long>(0L))); +// fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L), new TmfLocation<Long>(0L))); + ITmfContext context = new TmfContext(new TmfLocation<Long>(0L), 0); + fIndexer.updateIndex(context, new LttngTimestamp(0L)); // } // else { // indexTrace(true); @@ -104,7 +105,7 @@ public class LTTngTextTrace extends TmfTrace<LttngEvent> { // *** VERIFY *** // Is this safe? - fCheckpoints = oldTrace.fCheckpoints; +// fCheckpoints = oldTrace.fCheckpoints; } private boolean positionToFirstEvent() { diff --git a/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java b/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java index d14f7c2b21..cc65e7ae9b 100644 --- a/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java +++ b/lttng/org.eclipse.linuxtools.lttng.core/src/org/eclipse/linuxtools/internal/lttng/core/trace/LTTngTrace.java @@ -307,7 +307,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> { */ public LTTngTrace(final LTTngTrace other) throws Exception { this(other.getResource(), other.getPath(), other.getTraceLibPath(), false, true); - this.fCheckpoints = other.fCheckpoints; +// this.fCheckpoints = other.fCheckpoints; setTimeRange(new TmfTimeRange(new LttngTimestamp(other.getStartTime()), new LttngTimestamp(other.getEndTime()))); } @@ -526,17 +526,23 @@ public class LTTngTrace extends TmfTrace<LttngEvent> { if (PRINT_DEBUG) System.out.println("seekEvent(rank) rank -> " + rank); //$NON-NLS-1$ - ITmfTimestamp timestamp = null; +// 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 = fIndexer.seekIndex(rank); + LttngLocation location = (LttngLocation) checkpointContext.getLocation(); + ITmfTimestamp timestamp = location.getLocation(); 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(); - // Seek to the found time final TmfContext tmpContext = seekEvent(timestamp); tmpContext.setRank((index + 1) * fCacheSize); @@ -667,7 +673,7 @@ public class LTTngTrace extends TmfTrace<LttngEvent> { // long eventTime = eventTimestamp.getValue(); previousLocation.setOperationTime(eventTimestamp.getValue()); curLocation.setOperationTime(eventTimestamp.getValue()); - updateIndex(context, context.getRank(), eventTimestamp); + updateAttributes(context, eventTimestamp); context.increaseRank(); } @@ -1011,24 +1017,24 @@ public class LTTngTrace extends TmfTrace<LttngEvent> { return -1; } - /** - * Print the content of the checkpoint vector. - * <p> - * - * 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()); - } - } +// /** +// * Print the content of the checkpoint vector. +// * <p> +// * +// * 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() { |