Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.ctf.core.tests;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.ctf.core.tests.CtfCoreTestPlugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.ctf.core.tests,
org.eclipse.linuxtools.ctf.core.tests.shared
Import-Package: org.antlr.runtime;version="3.2.0"
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<name>Linux Tools CTF Core Tests Plug-in</name>
<groupId>org.eclipse.linuxtools.ctf</groupId>
<artifactId>org.eclipse.linuxtools.ctf.core.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<build>
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
-import java.util.List;
import java.util.Random;
+import java.util.TreeSet;
import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces;
}
private long testMain() {
- List<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
+ TreeSet<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
CTFCallsite cs = fTrace.getCallsite(1);
CTFCallsite cs1 = fTrace.getCallsite(callsites[0]);
CTFCallsite cs2 = fTrace.getCallsite(callsites[0], 1);
* Contributors:
* Matthew Khouzam - Initial API and implementation
* Marc-Andre Laperle - Test in traces directory recursively
+ * Simon Delisle - Add test for getCallsite(eventName, ip)
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.tests.trace;
}
}
+ /**
+ * Test for getCallsite(eventName, ip)
+ */
+ @Test
+ public void callsitePosition(){
+ long ip1 = 2;
+ long ip2 = 5;
+ long ip3 = 7;
+ CTFTrace callsiteTest = CtfTestTraces.getTestTraceFromFile(TRACE_INDEX);
+ callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
+ callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
+ callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
+
+ assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
+ assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
+ assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
+ assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
+ }
+
}
String result = fixture.toString();
assertNotNull(result);
}
+
+ /**
+ * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+ * for unsigned values.
+ */
+ @Test
+ public void testFormatNumber_unsignedLong() {
+
+ long unsignedLongValue = -64;
+ String result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ // -64 + 2^64 = 18446744073709551552
+ assertEquals("18446744073709551552", result);
+
+ unsignedLongValue = -131940199973272L;
+ result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ // -131940199973272l + 2^64 = 18446612133509578344
+ assertEquals("18446612133509578344", result);
+
+ unsignedLongValue = 123456789L;
+ result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ assertEquals("123456789", result);
+ }
+
+ /**
+ * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+ * for signed values.
+ */
+ @Test
+ public void testFormatNumber_signedLong() {
+ long signedValue = -64L;
+ String result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("-64", result);
+
+ signedValue = -131940199973272L;
+ result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("-131940199973272", result);
+
+ signedValue = 123456789L;
+ result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("123456789", result);
+ }
}
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.ctf.core;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.ctf.core.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.linuxtools.ctf.parser;bundle-version="1.0.0"
+ org.eclipse.linuxtools.ctf.parser;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.ctf.core.event,
org.eclipse.linuxtools.ctf.core.event.io,
org.eclipse.linuxtools.ctf.core.event.types,
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<name>Linux Tools CTF Core Plug-in</name>
<groupId>org.eclipse.linuxtools.ctf</groupId>
<artifactId>org.eclipse.linuxtools.ctf.core</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
package org.eclipse.linuxtools.ctf.core.event.types;
+import java.math.BigInteger;
import java.nio.ByteOrder;
import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
/**
* A CTF integer definition.
*
- * The definition of a integer basic data type. It will take the data
- * from a trace and store it (and make it fit) as a long.
+ * The definition of a integer basic data type. It will take the data from a
+ * trace and store it (and make it fit) as a long.
*
* @version 1.0
* @author Matthew Khouzam
/**
* Constructor
- * @param declaration the parent declaration
- * @param definitionScope the parent scope
- * @param fieldName the field name
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
*/
public IntegerDefinition(IntegerDeclaration declaration,
IDefinitionScope definitionScope, String fieldName) {
/**
* Gets the value of the integer
+ *
* @return the value of the integer (in long)
*/
public long getValue() {
/**
* Sets the value of an integer
- * @param val the value
+ *
+ * @param val
+ * the value
*/
public void setValue(long val) {
value = val;
return declaration;
}
-
-
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
char c = (char) value;
return Character.toString(c);
}
- return String.valueOf(value);
+ return formatNumber(value, declaration.getBase(), declaration.isSigned());
+ }
+
+ /**
+ * Print a numeric value as a string in a given base
+ *
+ * @param value
+ * The value to print as string
+ * @param base
+ * The base for this value
+ * @param signed
+ * Is the value signed or not
+ * @return formatted number string
+ * @since 3.0
+ */
+ public static final String formatNumber(long value, int base, boolean signed) {
+ String s;
+ /* Format the number correctly according to the integer's base */
+ switch (base) {
+ case 2:
+ s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
+ break;
+ case 8:
+ s = "0" + Long.toOctalString(value); //$NON-NLS-1$
+ break;
+ case 16:
+ s = "0x" + Long.toHexString(value); //$NON-NLS-1$
+ break;
+ case 10:
+ default:
+ /* For non-standard base, we'll just print it as a decimal number */
+ if (!signed && value < 0) {
+ /*
+ * Since there are no 'unsigned long', handle this case with
+ * BigInteger
+ */
+ BigInteger bigInteger = BigInteger.valueOf(value);
+ /*
+ * we add 2^64 to the negative number to get the real unsigned
+ * value
+ */
+ bigInteger = bigInteger.add(BigInteger.valueOf(1).shiftLeft(64));
+ s = bigInteger.toString();
+ } else {
+ s = Long.toString(value);
+ }
+ break;
+ }
+ return s;
}
}
* Contributors:
* Matthew Khouzam - Initial API and implementation
* Alexandre Montplaisir - Initial API and implementation
+ * Simon Delisle - Replace LinkedList by TreeSet in callsitesByName attribute
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.trace;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
+import org.eclipse.linuxtools.internal.ctf.core.event.CTFCallsiteComparator;
import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException;
import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndex;
private final Map<StreamInput, StreamInputPacketIndex> indexes = new HashMap<StreamInput, StreamInputPacketIndex>();
/** Callsite helpers */
- private Map<String, LinkedList<CTFCallsite>> callsitesByName = new HashMap<String, LinkedList<CTFCallsite>>();
+ private CTFCallsiteComparator ctfCallsiteComparator = new CTFCallsiteComparator();
+
+ private Map<String, TreeSet<CTFCallsite>> callsitesByName = new HashMap<String, TreeSet<CTFCallsite>>();
/** Callsite helpers */
private TreeSet<CTFCallsite> callsitesByIP = new TreeSet<CTFCallsite>();
String fileName, long lineNumber) {
final CTFCallsite cs = new CTFCallsite(eventName, funcName, ip,
fileName, lineNumber);
- LinkedList<CTFCallsite> csl = callsitesByName.get(eventName);
+ TreeSet<CTFCallsite> csl = callsitesByName.get(eventName);
if (csl == null) {
- csl = new LinkedList<CTFCallsite>();
+ csl = new TreeSet<CTFCallsite>(ctfCallsiteComparator);
callsitesByName.put(eventName, csl);
}
- ListIterator<CTFCallsite> iter = csl.listIterator();
- int index = 0;
- for (; index < csl.size(); index++) {
- if (iter.next().compareTo(cs) < 0) {
- break;
- }
- }
-
- csl.add(index, cs);
+ csl.add(cs);
callsitesByIP.add(cs);
}
/**
- * Gets the list of callsites associated to an event name. O(1)
+ * Gets the set of callsites associated to an event name. O(1)
*
* @param eventName
* the event name
- * @return the callsite list can be empty
- * @since 1.2
+ * @return the callsite set can be empty
+ * @since 3.0
*/
- public List<CTFCallsite> getCallsiteCandidates(String eventName) {
- LinkedList<CTFCallsite> retVal = callsitesByName.get(eventName);
+ public TreeSet<CTFCallsite> getCallsiteCandidates(String eventName) {
+ TreeSet<CTFCallsite> retVal = callsitesByName.get(eventName);
if (retVal == null) {
- retVal = new LinkedList<CTFCallsite>();
+ retVal = new TreeSet<CTFCallsite>(ctfCallsiteComparator);
}
return retVal;
}
* @since 1.2
*/
public CTFCallsite getCallsite(String eventName) {
- LinkedList<CTFCallsite> callsites = callsitesByName.get(eventName);
+ TreeSet<CTFCallsite> callsites = callsitesByName.get(eventName);
if (callsites != null) {
- return callsites.getFirst();
+ return callsites.first();
}
return null;
}
* @return the closest matching callsite, can be null
*/
public CTFCallsite getCallsite(String eventName, long ip) {
- final LinkedList<CTFCallsite> candidates = callsitesByName.get(eventName);
+ final TreeSet<CTFCallsite> candidates = callsitesByName.get(eventName);
final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1);
- final int pos = Collections.binarySearch(candidates, dummyCs) + 1;
- if (pos >= candidates.size()) {
- return null;
+ final CTFCallsite callsite = candidates.ceiling(dummyCs);
+ if (callsite == null) {
+ return candidates.floor(dummyCs);
}
- return candidates.get(pos);
+ return callsite;
}
-
}
class MetadataFileFilter implements FileFilter {
* Gets the event definition hashmap for this StreamInput
*
* @return Unmodifiable map with the event definitions
- * @since 2.1
+ * @since 3.0
*/
public Map<Long, EventDefinition> getEventDefinitions() {
return Collections.unmodifiableMap(eventDefs);
* existing definition with the same id.
* @param def
* The matching event definition
- * @since 2.1
+ * @since 3.0
*/
public void addEventDefinition(Long id, EventDefinition def) {
eventDefs.put(id, def);
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon Delisle - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.ctf.core.event;
+
+import java.util.Comparator;
+
+import org.eclipse.linuxtools.ctf.core.event.CTFCallsite;
+
+/**
+ * Comparator for CTFCallsite
+ *
+ * @author Simon Delisle
+ * @since 3.0
+ *
+ */
+public class CTFCallsiteComparator implements Comparator<CTFCallsite> {
+
+ private static final long MASK32 = 0x00000000ffffffffL;
+
+ /*
+ * The callsites will be sorted by calling addresses. To do this we take IPs
+ * (instruction pointers) and compare them. Java only supports signed
+ * operation and since memory addresses are unsigned, we will convert the
+ * longs into integers that contain the high and low bytes and compare them.
+ */
+ @Override
+ public int compare(CTFCallsite o1, CTFCallsite o2) {
+ /*
+ * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
+ * will return the lower 32 bits
+ */
+
+ long other = o2.getIp();
+ /*
+ * To get a high int: we downshift by 32 and bitwise and with the mask
+ * to get rid of the sign
+ *
+ * To get the low int: we bitwise and with the mask.
+ */
+ long otherHigh = (other >> 32) & MASK32;
+ long otherLow = other & MASK32;
+ long ownHigh = (o1.getIp() >> 32) & MASK32;
+ long ownLow = o1.getIp() & MASK32;
+ /* are the high values different, if so ignore the lower values */
+ if (ownHigh > otherHigh) {
+ return 1;
+ }
+ if (ownHigh < otherHigh ) {
+ return -1;
+ }
+ /* the high values are the same, compare the lower values */
+ if (ownLow > otherLow) {
+ return 1;
+ }
+ if (ownLow < otherLow) {
+ return -1;
+ }
+ /* the values are identical */
+ return 0;
+ }
+
+}
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.ctf.parser
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<name>Linux Tools CTF Parser Plug-in</name>
<groupId>org.eclipse.linuxtools.ctf</groupId>
<artifactId>org.eclipse.linuxtools.ctf.parser</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<feature
id="org.eclipse.linuxtools.ctf"
label="%featureName"
- version="2.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<name>Linux Tools CTF (Common Trace Format) Feature</name>
<artifactId>org.eclipse.linuxtools.ctf</artifactId>
<groupId>org.eclipse.linuxtools.ctf</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.core.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
- org.eclipse.linuxtools.gdbtrace.core;bundle-version="1.1.0"
+ org.eclipse.linuxtools.gdbtrace.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.gdbtrace.core.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace.core.tests</artifactId>
<groupId>org.eclipse.linuxtools.gdbtrace</groupId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools GDB Tracepoint Analysis Core Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.core;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.linuxtools.internal.gdbtrace.core.GdbTraceCorePlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.ide,
org.eclipse.debug.core,
org.eclipse.debug.ui,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace.core</artifactId>
<groupId>org.eclipse.linuxtools.gdbtrace</groupId>
+<<<<<<< HEAD
+ <version>3.0.0-SNAPSHOT</version>
+=======
<version>1.1.0-SNAPSHOT</version>
+>>>>>>> master
<packaging>eclipse-plugin</packaging>
<name>Linux Tools GDB Tracepoint Analysis Core Plug-in</name>
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
/**
* GDB Tracepoint extension of TmfTrace. This class implements the necessary
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.help;singleton:=true
Require-Bundle: org.eclipse.help
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace.help</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools GDB Tracepoint Analysis Help Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.ui.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
org.eclipse.ui,
- org.eclipse.linuxtools.gdbtrace.ui;bundle-version="1.1.0"
+ org.eclipse.linuxtools.gdbtrace.ui;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.gdbtrace.ui.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace.ui.tests</artifactId>
<groupId>org.eclipse.linuxtools.gdbtrace</groupId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools GDB Tracepoint Analysis UI Tests Plug-in</name>
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-SymbolicName: org.eclipse.linuxtools.gdbtrace.ui;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.linuxtools.internal.gdbtrace.ui.GdbTraceUIPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.console,
org.eclipse.ui.ide,
org.eclipse.debug.ui,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.gdbtrace.core;bundle-version="1.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.gdbtrace.core;bundle-version="3.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.linuxtools.internal.gdbtrace.ui;x-friends:="org.eclipse.linuxtools.gdbtrace.ui.tests",
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace.ui</artifactId>
<groupId>org.eclipse.linuxtools.gdbtrace</groupId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools GDB Tracepoint Analysis UI Plug-in</name>
<feature
id="org.eclipse.linuxtools.gdbtrace"
label="%featureName"
- version="1.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
<import plugin="org.eclipse.cdt.dsf"/>
<import plugin="org.eclipse.cdt.dsf.gdb"/>
<import plugin="org.eclipse.cdt.dsf.gdb.ui"/>
- <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.gdbtrace.core" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.gdbtrace.core" version="3.0.0" match="greaterOrEqual"/>
</requires>
<plugin
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.gdbtrace</artifactId>
<groupId>org.eclipse.linuxtools.gdbtrace</groupId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools GDB Tracepoint Analysis Feature</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng.help; singleton:=true
Require-Bundle: org.eclipse.help
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng.help</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Help Plug-in</name>
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng.releng-site</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<name>Linux Tools LTTng Repository</name>
<packaging>eclipse-repository</packaging>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.core.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.lttng2.core.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.core.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng Core Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.core;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.core.Activator
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.core</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Core Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.core.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core.tests;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.lttng2.kernel.core.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.kernel.core.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng Kernel Analysis Core Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.core;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.kernel.core.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.core;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.kernel.core.tests",
org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider;x-friends:="org.eclipse.linuxtools.lttng2.kernel.core.tests",
org.eclipse.linuxtools.lttng2.kernel.core.trace
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.kernel.core</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Kernel Analysis Core Plug-in</name>
return validStatus;
}
+ /**
+ * @since 3.0
+ */
@Override
- protected void buildStateSystem() throws TmfTraceException {
+ protected IStatus buildStateSystem() {
super.buildStateSystem();
/* Build the state system specific to LTTng kernel traces */
final File htFile = new File(directory + HISTORY_TREE_FILE_NAME);
final ITmfStateProvider htInput = new LttngKernelStateProvider(this);
- ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
- fStateSystems.put(STATE_ID, ss);
+ try {
+ ITmfStateSystem ss = TmfStateSystemFactory.newFullHistory(htFile, htInput, false);
+ fStateSystems.put(STATE_ID, ss);
+ } catch (TmfTraceException e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ }
+ return Status.OK_STATUS;
}
}
public static String LttngKernelTrace_DomainError;
/**
* Malformed trace (buffer overflow maybe?)
- * @since 2.1
+ * @since 3.0
*/
public static String LttngKernelTrace_MalformedTrace;
/**
* Trace read error
- * @since 2.1
+ * @since 3.0
*/
public static String LttngKernelTrace_TraceReadError;
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.ui.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
org.eclipse.ui,
- org.eclipse.linuxtools.lttng2.kernel.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.kernel.ui;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.lttng2.kernel.ui.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.kernel.ui.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng Kernel Analysis UI Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.kernel.ui;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.kernel.ui.Activator
org.eclipse.ui.ide,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.kernel.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.kernel.ui;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui.tests",
org.eclipse.linuxtools.internal.lttng2.kernel.ui.viewers.events;x-internal:=true,
org.eclipse.linuxtools.internal.lttng2.kernel.ui.views;x-internal:=true,
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.kernel.ui</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Kernel Analysis UI Plug-in</name>
<feature
id="org.eclipse.linuxtools.lttng2.kernel"
label="%featureName"
- version="2.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
<requires>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.lttng2.core" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.lttng2.ui" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.lttng2.kernel.core" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.lttng2.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.lttng2.ui" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.lttng2.kernel.core" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.help"/>
</requires>
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.kernel</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools LTTng Kernel Analysis Feature</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ui.tests;singleton:=true
Bundle-ActivationPolicy: lazy
org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.ide,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.lttng2.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.ui;bundle-version="3.0.0"
Import-Package: org.eclipse.rse.core,
org.eclipse.rse.core.model,
org.eclipse.rse.core.subsystems,
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ui.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng UI Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ui;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ui.Activator
org.eclipse.ui.ide,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.ui;x-friends:="org.eclipse.linuxtools.lttng2.ui.tests",
org.eclipse.linuxtools.internal.lttng2.ui.views.control;x-friends:="org.eclipse.linuxtools.lttng2.kernel.ui,org.eclipse.linuxtools.lttng2.ui.tests",
org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;x-friends:="org.eclipse.linuxtools.lttng2.ui.tests",
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ui</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng UI Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.core.tests;singleton:=true
Bundle-ActivationPolicy: lazy
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ust.core.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng Userspace Tracer Analysis Core Test Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.core;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ust.core.Activator
org.eclipse.linuxtools.lttng2.ust.core.trace
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ust.core</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Userspace Tracer Analysis Core Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.ui.tests;singleton:=true
Bundle-ActivationPolicy: lazy
org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.linuxtools.lttng2.ust.ui;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.ust.ui;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.lttng2.ust.ui.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ust.ui.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools LTTng Userspace Tracer Analysis UI Tests Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.ui;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.lttng2.ust.ui.Activator
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.ui,
- org.eclipse.linuxtools.lttng2.ust.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.lttng2.ust.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.lttng2.ust.ui;x-friends:="org.eclipse.linuxtools.lttng2.ust.ui.tests"
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ust.ui</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools LTTng Userspace Tracer Analysis UI Plug-in</name>
<feature
id="org.eclipse.linuxtools.lttng2.ust"
label="%featureName"
- version="2.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
<requires>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.help"/>
</requires>
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2.ust</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools LTTng Userspace Tracer Analysis Feature</name>
<feature
id="org.eclipse.linuxtools.lttng2"
label="%featureName"
- version="2.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.linuxtools.lttng2.core" version="2.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.tmf.core" version="2.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.linuxtools.tmf.ui" version="2.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.lttng2.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.ui" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.help"/>
<import feature="org.eclipse.rse" version="3.1.100" match="greaterOrEqual"/>
</requires>
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.lttng2</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools LTTng (Linux Tracing Toolkit) Feature</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.tmf.core.tests;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin
Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.ctf.core.tests;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.ctf.core.tests;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.tmf.core.tests,
org.eclipse.linuxtools.tmf.core.tests.shared,
org.eclipse.linuxtools.tmf.tests.stubs.trace;x-friends:="org.eclipse.linuxtools.tmf.ui.tests"
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf.core.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools TMF Core Tests Plug-in</name>
org.eclipse.linuxtools.tmf.core.tests.statesystem.AllTests.class,
org.eclipse.linuxtools.tmf.core.tests.statistics.AllTests.class,
org.eclipse.linuxtools.tmf.core.tests.trace.AllTests.class,
+ org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint.AllTests.class,
+ org.eclipse.linuxtools.tmf.core.tests.trace.location.AllTests.class,
org.eclipse.linuxtools.tmf.core.tests.uml2sd.AllTests.class,
org.eclipse.linuxtools.tmf.core.tests.util.AllTests.class
})
import org.eclipse.linuxtools.tmf.core.component.ITmfDataProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal;
import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
*/
@Test
public void testGetPlainEvents() {
- final int BLOCK_SIZE = 100;
final int NB_EVENTS = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
ITmfDataProvider provider = eventProviders[0];
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
*/
@Test
public void testCancelRequests() {
-
- final int BLOCK_SIZE = 100;
final int NB_EVENTS = 1000;
final int NUMBER_EVENTS_BEFORE_CANCEL_REQ1 = 10;
final int NUMBER_EVENTS_BEFORE_CANCEL_REQ2 = 800;
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
// Create first request
- final TmfEventRequest request1 = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ final TmfEventRequest request1 = new TmfEventRequest(ITmfEvent.class,
+ range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
assertFalse("isRunning", request1.isRunning());
// Create second request
- final TmfEventRequest request2 = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ final TmfEventRequest request2 = new TmfEventRequest(ITmfEvent.class,
+ range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
}
private static void getSyntheticData(final TmfTimeRange range,
- final int nbEvents, final int blockSize) throws InterruptedException {
+ final int nbEvents) throws InterruptedException {
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
ITmfDataProvider provider = eventProviders[0];
final TmfEventRequest request = new TmfEventRequest(TmfSyntheticEventStub.class, range,
- nbEvents, blockSize) {
+ 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
public void testGetSyntheticEvents_EqualBlockSizes() {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
try {
- getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE);
- } catch (InterruptedException e) {
- fail();
- }
- }
-
- /**
- * Test getSyntheticEvents for smaller block sizes.
- */
- @Test
- public void testGetSyntheticEvents_SmallerBlock() {
- TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- try {
- getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE / 2);
- } catch (InterruptedException e) {
- fail();
- }
- }
-
- /**
- * Test getSyntheticEvents for larger block sizes.
- */
- @Test
- public void testGetSyntheticEvents_LargerBlock() {
- TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- try {
- getSyntheticData(range, 1000, TmfSyntheticEventProviderStub.BLOCK_SIZE * 2);
+ getSyntheticData(range, 1000);
} catch (InterruptedException e) {
fail();
}
TmfTimestamp end = new TmfTimestamp(1000, (byte) -3, 0);
TmfTimeRange range = new TmfTimeRange(start, end);
try {
- getSyntheticData(range, -1, TmfSyntheticEventProviderStub.BLOCK_SIZE);
+ getSyntheticData(range, -1);
} catch (InterruptedException e) {
fail();
}
CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
assertEquals("test=float=9.551467814359616E-38", result.toString());
}
-
- /**
- * Run the CtfTmfEventField formatNumber(Long, int, boolean) method test for
- * unsigned values.
- */
- @Test
- public void testFormatNumber_unsignedLong() {
-
- long unsignedLongValue = -64;
- String result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
- // -64 + 2^64 = 18446744073709551552
- assertEquals("18446744073709551552", result);
-
- unsignedLongValue = -131940199973272L;
- result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
- // -131940199973272l + 2^64 = 18446612133509578344
- assertEquals("18446612133509578344", result);
-
- unsignedLongValue = 123456789L;
- result = CtfTmfEventField.formatNumber(unsignedLongValue, 10, false);
- assertEquals("123456789", result);
- }
-
- /**
- * Run the CtfTmfEventField formatNumber(Long, int, boolean) method test for
- * signed values.
- */
- @Test
- public void testFormatNumber_signedLong() {
- long signedValue = -64L;
- String result = CtfTmfEventField.formatNumber(signedValue, 10, true);
- assertEquals("-64", result);
-
- signedValue = -131940199973272L;
- result = CtfTmfEventField.formatNumber(signedValue, 10, true);
- assertEquals("-131940199973272", result);
-
- signedValue = 123456789L;
- result = CtfTmfEventField.formatNumber(signedValue, 10, true);
- assertEquals("123456789", result);
- }
}
assertArrayEquals(fields2, fields);
}
+ /**
+ * Run the ITmfEventField getSubFieldValue(String[]) method test.
+ */
+ @Test
+ public void testGetSubFieldValue() {
+ /* Field exists */
+ String[] names = { "pid" };
+ assertNotNull(fixture.getContent().getSubField(names));
+
+ /* First field exists, not the second */
+ String[] names2 = { "pid", "abcd" };
+ assertNull(fixture.getContent().getSubField(names2));
+
+ /* Both field do not exist */
+ String[] names3 = { "pfid", "abcd" };
+ assertNull(fixture.getContent().getSubField(names3));
+
+ /* TODO Missing case of embedded field, need event for it */
+ }
+
/**
* Run the long getID() method test.
*/
assertTrue(fixture.hasAtLeastOneOfEvents(names));
assertFalse(fixture.hasAllEvents(names));
}
+
+ /**
+ * Run the String getHostId() method test
+ */
+ @Test
+ public void testCtfHostId() {
+ String a = fixture.getHostId();
+ assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
+ }
+
}
public EventContextTestRequest(long timestamp) {
super(CtfTmfEvent.class,
new TmfTimeRange(new CtfTmfTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
- 0, 1, 1, ExecutionType.FOREGROUND);
+ 0, 1, ExecutionType.FOREGROUND);
}
@Override
private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
final TmfTimeRange range, final int nbRequested) {
- super(dataType, range, nbRequested, 1);
+ super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
}
// Path of the trace
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
final File test = new File(FileLocator.toFileURL(location).toURI());
- trace = new TmfTraceStub(test.toURI().getPath(), 500, false);
+ trace = new TmfTraceStub(test.toURI().getPath(), 500, false, null, null);
} catch (final TmfTraceException e) {
e.printStackTrace();
} catch (final URISyntaxException e) {
import org.eclipse.linuxtools.internal.tmf.core.request.TmfCoalescedDataRequest;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.tests.stubs.request.TmfDataRequestStub;
import org.junit.Before;
import org.junit.Test;
@Before
public void setUp() {
TmfDataRequest.reset();
- fRequest1 = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- fRequest2 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 100, 200);
- fRequest3 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, 200);
- fRequest4 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, 300);
+ fRequest1 = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ fRequest2 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 100, ExecutionType.FOREGROUND);
+ fRequest3 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, ExecutionType.FOREGROUND);
+ fRequest4 = new TmfCoalescedDataRequest(ITmfEvent.class, 20, 200, ExecutionType.FOREGROUND);
- fRequest1b = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- fRequest1c = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
+ fRequest1b = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ fRequest1c = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
fRequestCount = fRequest1c.getRequestId() + 1;
}
private static TmfCoalescedDataRequest setupTestRequest(final boolean[] flags) {
- TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200) {
+ TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND) {
@Override
public void handleCompleted() {
super.handleCompleted();
}
// ------------------------------------------------------------------------
- // Constructors
+ // Constructor
// ------------------------------------------------------------------------
- @Test
- public void testTmfCoalescedDataRequest() {
- TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getIndex", 0, request.getIndex());
- assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
- @Test
- public void testTmfCoalescedDataRequestIndex() {
- TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getIndex", 10, request.getIndex());
- assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
- @Test
- public void testTmfCoalescedDataRequestIndexNbRequested() {
- TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getIndex", 10, request.getIndex());
- assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
@Test
public void testTmfCoalescedDataRequestIndexNbEventsBlocksize() {
- TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
+ TmfCoalescedDataRequest request = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
assertEquals("getRequestId", fRequestCount++, request.getRequestId());
assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@Test
public void testToString() {
- String expected1 = "[TmfCoalescedDataRequest(0,ITmfEvent,FOREGROUND,10,100,200, [])]";
- String expected2 = "[TmfCoalescedDataRequest(1,ITmfEvent,FOREGROUND,20,100,200, [])]";
- String expected3 = "[TmfCoalescedDataRequest(2,ITmfEvent,FOREGROUND,20,200,200, [])]";
- String expected4 = "[TmfCoalescedDataRequest(3,ITmfEvent,FOREGROUND,20,200,300, [])]";
+ String expected1 = "[TmfCoalescedDataRequest(0,ITmfEvent,FOREGROUND,10,100, [])]";
+ String expected2 = "[TmfCoalescedDataRequest(1,ITmfEvent,FOREGROUND,20,100, [])]";
+ String expected3 = "[TmfCoalescedDataRequest(2,ITmfEvent,FOREGROUND,20,200, [])]";
+ String expected4 = "[TmfCoalescedDataRequest(3,ITmfEvent,FOREGROUND,20,200, [])]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@Test
public void testIsCompatible() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request2 = new TmfDataRequestStub(ITmfEvent.class, 5, 100, 200);
- TmfDataRequest request3 = new TmfDataRequestStub(ITmfEvent.class, 5, 4, 200);
- TmfDataRequest request4 = new TmfDataRequestStub(ITmfEvent.class, 5, 5, 200);
- TmfDataRequest request5 = new TmfDataRequestStub(ITmfEvent.class, 15, 100, 200);
- TmfDataRequest request6 = new TmfDataRequestStub(ITmfEvent.class, 100, 100, 200);
- TmfDataRequest request7 = new TmfDataRequestStub(ITmfEvent.class, 110, 100, 200);
- TmfDataRequest request8 = new TmfDataRequestStub(ITmfEvent.class, 111, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ TmfDataRequest request2 = new TmfDataRequestStub(ITmfEvent.class, 5, 100);
+ TmfDataRequest request3 = new TmfDataRequestStub(ITmfEvent.class, 5, 4);
+ TmfDataRequest request4 = new TmfDataRequestStub(ITmfEvent.class, 5, 5);
+ TmfDataRequest request5 = new TmfDataRequestStub(ITmfEvent.class, 15, 100);
+ TmfDataRequest request6 = new TmfDataRequestStub(ITmfEvent.class, 100, 100);
+ TmfDataRequest request7 = new TmfDataRequestStub(ITmfEvent.class, 110, 100);
+ TmfDataRequest request8 = new TmfDataRequestStub(ITmfEvent.class, 111, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request1));
assertTrue("isCompatible", coalescedRequest.isCompatible(request2));
assertTrue("isCompatible", coalescedRequest.isCompatible(request7));
assertTrue("isCompatible", coalescedRequest.isCompatible(request8));
- TmfDataRequest request9 = new TmfDataRequestStub(ITmfEvent.class, 5, 3, 200);
- TmfDataRequest request10 = new TmfDataRequestStub(ITmfEvent.class, 112, 100, 200);
+ TmfDataRequest request9 = new TmfDataRequestStub(ITmfEvent.class, 5, 3);
+ TmfDataRequest request10 = new TmfDataRequestStub(ITmfEvent.class, 112, 100);
assertFalse("isCompatible", coalescedRequest.isCompatible(request9));
assertFalse("isCompatible", coalescedRequest.isCompatible(request10));
@Test
public void testAddRequest1() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 10, coalescedRequest.getIndex());
assertEquals("addRequest", 100, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest2() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 5, coalescedRequest.getIndex());
assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest3() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 4, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 4);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 5, coalescedRequest.getIndex());
assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest4() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 5, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 5, 5);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 5, coalescedRequest.getIndex());
assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest5() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 15, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 15, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 10, coalescedRequest.getIndex());
assertEquals("addRequest", 105, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest6() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 100, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 100, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 10, coalescedRequest.getIndex());
assertEquals("addRequest", 190, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest7() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 110, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 110, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 10, coalescedRequest.getIndex());
assertEquals("addRequest", 200, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
@Test
public void testAddRequest8() {
- TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 111, 100, 200);
+ TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(ITmfEvent.class, 10, 100, ExecutionType.FOREGROUND);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 111, 100);
assertTrue("isCompatible", coalescedRequest.isCompatible(request));
coalescedRequest.addRequest(request);
assertEquals("addRequest", 10, coalescedRequest.getIndex());
assertEquals("addRequest", 201, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
}
// ------------------------------------------------------------------------
// Test request
final boolean[] crFlags = new boolean[4];
TmfCoalescedDataRequest request = setupTestRequest(crFlags);
- TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
public void testFail() {
final boolean[] crFlags = new boolean[4];
TmfCoalescedDataRequest request = setupTestRequest(crFlags);
- TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
public void testCancel() {
final boolean[] crFlags = new boolean[4];
TmfCoalescedDataRequest request = setupTestRequest(crFlags);
- TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
public void testCancelSubRequests() {
final boolean[] crFlags = new boolean[4];
TmfCoalescedDataRequest request = setupTestRequest(crFlags);
- TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfDataRequest subRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ TmfDataRequest subRequest2 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
@Before
public void setUp() {
TmfDataRequest.reset();
- fRequest1 = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
- fRequest2 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 100, 200);
- fRequest3 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 200, 200);
- fRequest4 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 200, 300);
+ fRequest1 = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
+ fRequest2 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 100, ExecutionType.FOREGROUND);
+ fRequest3 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 200, ExecutionType.FOREGROUND);
+ fRequest4 = new TmfCoalescedEventRequest(ITmfEvent.class, range2, 0, 200, ExecutionType.FOREGROUND);
- fRequest1b = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
- fRequest1c = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+ fRequest1b = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
+ fRequest1c = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
fRequestCount = fRequest1c.getRequestId() + 1;
}
private TmfCoalescedEventRequest setupTestRequest(final boolean[] flags) {
- TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200) {
+ TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND) {
@Override
public void handleCompleted() {
super.handleCompleted();
}
// ------------------------------------------------------------------------
- // Constructors
+ // Constructor
// ------------------------------------------------------------------------
- @Test
- public void testTmfCoalescedEventRequest() {
- TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getRange", range1, request.getRange());
- assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
- @Test
- public void testTmfCoalescedEventRequestIndex() {
- TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getRange", range1, request.getRange());
- assertEquals("getNbRequestedEvents", TmfDataRequest.ALL_DATA, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
- public void testTmfCoalescedEventRequestIndexNbRequested() {
- TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100);
-
- assertEquals("getRequestId", fRequestCount++, request.getRequestId());
- assertEquals("getDataType", ITmfEvent.class, request.getDataType());
-
- assertEquals("getRange", range1, request.getRange());
- assertEquals("getNbRequestedEvents", 100, request.getNbRequested());
-
- assertFalse("isCompleted", request.isCompleted());
- assertFalse("isFailed", request.isFailed());
- assertFalse("isCancelled", request.isCancelled());
-
- assertEquals("getNbRead", 0, request.getNbRead());
- }
-
@Test
public void testTmfCoalescedEventRequestIndexNbEventsBlocksize() {
- TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+ TmfCoalescedEventRequest request = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
assertEquals("getRequestId", fRequestCount++, request.getRequestId());
assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@Test
public void testEqualsSuper() {
TmfCoalescedDataRequest dataRequest1 = new TmfCoalescedDataRequest(
- fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
+ fRequest1.getDataType(),
+ fRequest1.getIndex(),
+ fRequest1.getNbRequested(),
+ ExecutionType.FOREGROUND);
TmfCoalescedDataRequest dataRequest2 = new TmfCoalescedDataRequest(
- fRequest1.getDataType(), fRequest1.getIndex(), fRequest1.getNbRequested());
+ fRequest1.getDataType(),
+ fRequest1.getIndex(),
+ fRequest1.getNbRequested(),
+ ExecutionType.FOREGROUND);
TmfCoalescedDataRequest dataRequest3 = new TmfCoalescedDataRequest(
- fRequest3.getDataType(), fRequest3.getIndex(), fRequest3.getNbRequested());
+ fRequest3.getDataType(),
+ fRequest3.getIndex(),
+ fRequest3.getNbRequested(),
+ ExecutionType.FOREGROUND);
assertTrue("equals", fRequest1.equals(dataRequest2));
assertTrue("equals", fRequest2.equals(dataRequest1));
@Test
public void testToString() {
- String expected1 = "[TmfCoalescedEventRequest(0,ITmfEvent,FOREGROUND," + range1 + ",0,100,200, [])]";
- String expected2 = "[TmfCoalescedEventRequest(1,ITmfEvent,FOREGROUND," + range2 + ",0,100,200, [])]";
- String expected3 = "[TmfCoalescedEventRequest(2,ITmfEvent,FOREGROUND," + range2 + ",0,200,200, [])]";
- String expected4 = "[TmfCoalescedEventRequest(3,ITmfEvent,FOREGROUND," + range2 + ",0,200,300, [])]";
+ String expected1 = "[TmfCoalescedEventRequest(0,ITmfEvent,FOREGROUND," + range1 + ",0,100, [])]";
+ String expected2 = "[TmfCoalescedEventRequest(1,ITmfEvent,FOREGROUND," + range2 + ",0,100, [])]";
+ String expected3 = "[TmfCoalescedEventRequest(2,ITmfEvent,FOREGROUND," + range2 + ",0,200, [])]";
+ String expected4 = "[TmfCoalescedEventRequest(3,ITmfEvent,FOREGROUND," + range2 + ",0,200, [])]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@Test
public void testIsCompatible() {
- TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 100, 200);
+ TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 100, ExecutionType.FOREGROUND);
TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range2, 100, 200);
TmfEventRequest req3 = new TmfEventRequestStub(ITmfEvent.class, range1, 101, 200);
@Test
public void testAddEvent1() {
- TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 2147483647, 200, ExecutionType.FOREGROUND);
+ TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 2147483647, ExecutionType.FOREGROUND);
TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 0, 2147483647, 200);
TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range1, 1, 2147483647, 200);
assertEquals("addRequest", 0, coalescedRequest.getIndex());
assertEquals("addRequest", 2147483647, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
-
}
@Test
public void testAddEvent2() {
- TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 1, 2147483647, 200, ExecutionType.FOREGROUND);
+ TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 1, 2147483647, ExecutionType.FOREGROUND);
TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 1, 2147483647, 200);
TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range1, 0, 2147483647, 200);
assertEquals("addRequest", 0, coalescedRequest.getIndex());
assertEquals("addRequest", 2147483647, coalescedRequest.getNbRequested());
- assertEquals("addRequest", 200, coalescedRequest.getBlockSize());
-
}
// ------------------------------------------------------------------------
private static final String DIRECTORY = "testfiles";
private static final String TEST_STREAM = "A-Test-10K";
private static final int NB_EVENTS = 5000;
- private static final int BLOCK_SIZE = 100;
// Initialize the test trace
private TmfTraceStub fTrace = null;
try {
URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.getPath(), 500);
+ fTrace = new TmfTraceStub(test.getPath(), 500, false, null, null);
} catch (TmfTraceException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
final long REQUEST_OFFSET = 1000;
requestedEvents1 = new Vector<ITmfEvent>();
- request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex, NB_EVENTS, BLOCK_SIZE) {
- int nbRead = 0;
+ request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex,
+ NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (!isCompleted()) {
requestedEvents1.add(event);
- if (++nbRead >= BLOCK_SIZE && signal.forceCancel) {
+ if (signal.forceCancel) {
cancel();
}
}
};
requestedEvents2 = new Vector<ITmfEvent>();
- request2 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + REQUEST_OFFSET, NB_EVENTS, BLOCK_SIZE) {
+ request2 = new TmfEventRequest(ITmfEvent.class, range,
+ signal.fIndex + REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
};
requestedEvents3 = new Vector<ITmfEvent>();
- request3 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, BLOCK_SIZE) {
+ request3 = new TmfEventRequest(ITmfEvent.class, range,
+ signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
request2.waitForCompletion();
request3.waitForCompletion();
- assertEquals("Request1: nbEvents", BLOCK_SIZE, requestedEvents1.size());
assertTrue("Request1: isCompleted", request1.isCompleted());
assertTrue("Request1: isCancelled", request1.isCancelled());
// Ensure that we have distinct events.
// Don't go overboard: we are not validating the stub!
- for (int i = 0; i < BLOCK_SIZE; i++) {
- assertEquals("Distinct events", i + 1 + request1.getIndex(), requestedEvents1.get(i).getTimestamp().getValue());
- }
for (int i = 0; i < NB_EVENTS; i++) {
assertEquals("Distinct events", i + 1 + request2.getIndex(), requestedEvents2.get(i).getTimestamp().getValue());
assertEquals("Distinct events", i + 1 + request3.getIndex(), requestedEvents3.get(i).getTimestamp().getValue());
@Before
public void setUp() {
TmfDataRequest.reset();
- fRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- fRequest2 = new TmfDataRequestStub(ITmfEvent.class, 20, 100, 200);
- fRequest3 = new TmfDataRequestStub(ITmfEvent.class, 20, 200, 200);
- fRequest4 = new TmfDataRequestStub(ITmfEvent.class, 20, 200, 300);
- fRequest1b = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
- fRequest1c = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ fRequest1 = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ fRequest2 = new TmfDataRequestStub(ITmfEvent.class, 20, 100);
+ fRequest3 = new TmfDataRequestStub(ITmfEvent.class, 20, 200);
+ fRequest4 = new TmfDataRequestStub(ITmfEvent.class, 20, 200);
+ fRequest1b = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
+ fRequest1c = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
fRequestCount = fRequest1c.getRequestId() + 1;
}
private static TmfDataRequest setupTestRequest(final boolean[] flags) {
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200) {
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100) {
@Override
public void handleCompleted() {
super.handleCompleted();
@Test
public void testTmfDataRequestIndexNbEventsBlocksize() {
- TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100, 200);
+ TmfDataRequest request = new TmfDataRequestStub(ITmfEvent.class, 10, 100);
assertEquals("getRequestId", fRequestCount++, request.getRequestId());
assertEquals("getDataType", ITmfEvent.class, request.getDataType());
@Test
public void testToString() {
- String expected1 = "[TmfDataRequestStub(0,ITmfEvent,FOREGROUND,10,100,200)]";
- String expected2 = "[TmfDataRequestStub(1,ITmfEvent,FOREGROUND,20,100,200)]";
- String expected3 = "[TmfDataRequestStub(2,ITmfEvent,FOREGROUND,20,200,200)]";
- String expected4 = "[TmfDataRequestStub(3,ITmfEvent,FOREGROUND,20,200,300)]";
+ String expected1 = "[TmfDataRequestStub(0,ITmfEvent,FOREGROUND,10,100)]";
+ String expected2 = "[TmfDataRequestStub(1,ITmfEvent,FOREGROUND,20,100)]";
+ String expected3 = "[TmfDataRequestStub(2,ITmfEvent,FOREGROUND,20,200)]";
+ String expected4 = "[TmfDataRequestStub(3,ITmfEvent,FOREGROUND,20,200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
@Test
public void testToString() {
- String expected1 = "[TmfEventRequestStub(0,ITmfEvent,FOREGROUND," + range1 + ",0,100,200)]";
- String expected2 = "[TmfEventRequestStub(1,ITmfEvent,FOREGROUND," + range2 + ",0,100,200)]";
- String expected3 = "[TmfEventRequestStub(2,ITmfEvent,FOREGROUND," + range2 + ",0,200,200)]";
- String expected4 = "[TmfEventRequestStub(3,ITmfEvent,FOREGROUND," + range2 + ",0,200,300)]";
+ String expected1 = "[TmfEventRequestStub(0,ITmfEvent,FOREGROUND," + range1 + ",0,100)]";
+ String expected2 = "[TmfEventRequestStub(1,ITmfEvent,FOREGROUND," + range2 + ",0,100)]";
+ String expected3 = "[TmfEventRequestStub(2,ITmfEvent,FOREGROUND," + range2 + ",0,200)]";
+ String expected4 = "[TmfEventRequestStub(3,ITmfEvent,FOREGROUND," + range2 + ",0,200)]";
assertEquals("toString", expected1, fRequest1.toString());
assertEquals("toString", expected2, fRequest2.toString());
// ------------------------------------------------------------------------
private class BackgroundRequest extends TmfEventRequest {
- private static final int CHUNK_SIZE = 0;
private int nbEvents = 0;
private String backgroundName;
BackgroundRequest(TmfTimeRange timeRange) {
- super(fixture.getEventType(), timeRange,
+ super(fixture.getEventType(),
+ timeRange,
+ 0,
TmfDataRequest.ALL_DATA,
- CHUNK_SIZE,
ExecutionType.BACKGROUND);
backgroundName = getExecType().toString() + ++fBackgroundId;
}
}
private class ForegroundRequest extends TmfEventRequest {
- private static final int CHUNK_SIZE = 0;
private int nbEvents = 0;
private String foregroundName;
ForegroundRequest(TmfTimeRange timeRange) {
- super(fixture.getEventType(), timeRange,
+ super(fixture.getEventType(),
+ timeRange,
+ 0,
TmfDataRequest.ALL_DATA,
- CHUNK_SIZE,
ExecutionType.FOREGROUND);
foregroundName = getExecType().toString() + ++fForegroundId;
}
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- TmfCheckpointIndexTest.class,
- TmfCheckpointIndexTest2.class,
- TmfCheckpointTest.class,
TmfContextTest.class,
- TmfExperimentCheckpointIndexTest.class,
TmfExperimentTest.class,
- TmfLocationTest.class,
TmfMultiTraceExperimentTest.class,
TmfTraceManagerTest.class,
TmfTraceTest.class
})
-public class AllTests {
-
-}
\ No newline at end of file
+public class AllTests {}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Adapted for TMF Trace Model 1.0
- * Alexandre Montplaisir - Port to JUnit4
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
-import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexTest class.
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointIndexTest {
-
- // ------------------------------------------------------------------------
- // Variables
- // ------------------------------------------------------------------------
-
- private static final String DIRECTORY = "testfiles";
- private static final String TEST_STREAM = "A-Test-10K";
- private static final int BLOCK_SIZE = 100;
- private static final int NB_EVENTS = 10000;
- private static TestTrace fTrace = null;
- private static EmptyTestTrace fEmptyTrace = null;
-
- // ------------------------------------------------------------------------
- // Housekeeping
- // ------------------------------------------------------------------------
-
- @Before
- public void setUp() {
- setupTrace(DIRECTORY + File.separator + TEST_STREAM);
- }
-
- @After
- public void tearDown() {
- fTrace.dispose();
- fTrace = null;
- fEmptyTrace.dispose();
- fEmptyTrace = null;
- }
-
- // ------------------------------------------------------------------------
- // Helper classes
- // ------------------------------------------------------------------------
-
- private static class TestIndexer extends TmfCheckpointIndexer {
- @SuppressWarnings({ })
- public TestIndexer(TestTrace testTrace) {
- super(testTrace, BLOCK_SIZE);
- }
- @SuppressWarnings({ })
- public TestIndexer(EmptyTestTrace testTrace) {
- super(testTrace, BLOCK_SIZE);
- }
- public List<ITmfCheckpoint> getCheckpoints() {
- return getTraceIndex();
- }
- }
-
- private class TestTrace extends TmfTraceStub {
- public TestTrace(String path, int blockSize) throws TmfTraceException {
- super(path, blockSize);
- setIndexer(new TestIndexer(this));
- }
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-
- private class EmptyTestTrace extends TmfEmptyTraceStub {
- public EmptyTestTrace() {
- super();
- setIndexer(new TestIndexer(this));
- }
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-
- // ------------------------------------------------------------------------
- // Helper functions
- // ------------------------------------------------------------------------
-
- private synchronized void setupTrace(final String path) {
- if (fTrace == null) {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
- fTrace.indexTrace(true);
- } catch (final TmfTraceException e) {
- e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
- }
- }
-
- if (fEmptyTrace == null) {
- fEmptyTrace = new EmptyTestTrace();
- fEmptyTrace.indexTrace(true);
- }
- }
-
- // ------------------------------------------------------------------------
- // Verify checkpoints
- // ------------------------------------------------------------------------
-
- @Test
- public void testTmfTraceIndexing() {
- assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
- assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
- assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, fTrace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, fTrace.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, fTrace.getEndTime().getValue());
-
- List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
- int pageSize = fTrace.getCacheSize();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-
- // Validate that each checkpoint points to the right event
- for (int i = 0; i < checkpoints.size(); i++) {
- ITmfCheckpoint checkpoint = checkpoints.get(i);
- TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
- ITmfEvent event = fTrace.parseEvent(context);
- assertTrue(context.getRank() == i * pageSize);
- assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
- }
- }
-
- @Test
- public void testEmptyTmfTraceIndexing() {
- assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, fEmptyTrace.getCacheSize());
- assertEquals("getTraceSize", 0, fEmptyTrace.getNbEvents());
- assertEquals("getRange-start", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getStartTime());
- assertEquals("getRange-end", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getEndTime());
- assertEquals("getStartTime", TmfTimestamp.BIG_BANG, fEmptyTrace.getStartTime());
- assertEquals("getEndTime", TmfTimestamp.BIG_BANG, fEmptyTrace.getEndTime());
-
- List<ITmfCheckpoint> checkpoints = fEmptyTrace.getIndexer().getCheckpoints();
- int pageSize = fEmptyTrace.getCacheSize();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", 0, checkpoints.size());
-
- // Validate that each checkpoint points to the right event
- for (int i = 0; i < checkpoints.size(); i++) {
- ITmfCheckpoint checkpoint = checkpoints.get(i);
- TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
- ITmfEvent event = fEmptyTrace.parseEvent(context);
- assertTrue(context.getRank() == i * pageSize);
- assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- * Alexandre Montplaisir - Port to JUnit4
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexer class (events with same
- * timestamp around checkpoint).
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointIndexTest2 {
-
- // ------------------------------------------------------------------------
- // Variables
- // ------------------------------------------------------------------------
-
- private static final String DIRECTORY = "testfiles";
- // Trace has 3 events at t=101 at rank 99, 100, 101
- // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
- private static final String TEST_STREAM = "A-Test-10K-2";
- private static final int BLOCK_SIZE = 100;
- private static final int NB_EVENTS = 702;
- private static TestTrace fTrace = null;
- private static EmptyTestTrace fEmptyTrace = null;
-
- // ------------------------------------------------------------------------
- // Housekeeping
- // ------------------------------------------------------------------------
-
- @Before
- public void setUp() {
- setupTrace(DIRECTORY + File.separator + TEST_STREAM);
- }
-
- @After
- public void tearDown() {
- fTrace.dispose();
- fTrace = null;
- fEmptyTrace.dispose();
- fEmptyTrace = null;
- }
-
- // ------------------------------------------------------------------------
- // Helper classes
- // ------------------------------------------------------------------------
-
- private static class TestIndexer extends TmfCheckpointIndexer {
- @SuppressWarnings({ })
- public TestIndexer(TestTrace testTrace) {
- super(testTrace, BLOCK_SIZE);
- }
- @SuppressWarnings({ })
- public TestIndexer(EmptyTestTrace testTrace) {
- super(testTrace, BLOCK_SIZE);
- }
- public List<ITmfCheckpoint> getCheckpoints() {
- return getTraceIndex();
- }
- }
-
- private class TestTrace extends TmfTraceStub {
- public TestTrace(String path, int blockSize) throws TmfTraceException {
- super(path, blockSize);
- setIndexer(new TestIndexer(this));
- }
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-
- private class EmptyTestTrace extends TmfEmptyTraceStub {
- public EmptyTestTrace() {
- super();
- setIndexer(new TestIndexer(this));
- }
- @Override
- public TestIndexer getIndexer() {
- return (TestIndexer) super.getIndexer();
- }
- }
-
- // ------------------------------------------------------------------------
- // Helper functions
- // ------------------------------------------------------------------------
-
- private synchronized void setupTrace(final String path) {
- if (fTrace == null) {
- try {
- final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
- final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
- fTrace.indexTrace(true);
- } catch (final TmfTraceException e) {
- e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
- }
- }
-
- if (fEmptyTrace == null) {
- fEmptyTrace = new EmptyTestTrace();
- fEmptyTrace.indexTrace(true);
- }
- }
-
- // ------------------------------------------------------------------------
- // Verify checkpoints
- // ------------------------------------------------------------------------
-
- @Test
- public void testTmfTraceMultiTimestamps() {
- assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
- assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
- assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", 102, fTrace.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, fTrace.getStartTime().getValue());
- assertEquals("getEndTime", 102, fTrace.getEndTime().getValue());
-
- List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE + 1, checkpoints.size());
-
- // Trace has 3 events with same timestamp (ts=101) at rank 99, 100, 101
-
- // Verify that the event at rank=99 is returned when seeking to ts=101 (first event with this timestamp)
- // and not the event at checkpoint boundary
- TmfTimestamp seekTs = new TmfTimestamp(101, -3, 0);
- ITmfContext ctx = fTrace.seekEvent(seekTs);
- ITmfEvent event = fTrace.getNext(ctx);
-
- assertEquals(99, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- event = fTrace.getNext(ctx);
-
- assertEquals(100, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- event = fTrace.getNext(ctx);
-
- assertEquals(101, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
- // Verify that the event at rank=102 is returned when seeking to ts=102 (first event with this timestamp)
- // and not the event at checkpoint boundary
- seekTs = new TmfTimestamp(102, -3, 0);
- ctx = fTrace.seekEvent(seekTs);
- event = fTrace.getNext(ctx);
-
- assertEquals(102, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- // Verify seek to first checkpoint
- seekTs = new TmfTimestamp(1, -3, 0);
- ctx = fTrace.seekEvent(seekTs);
- event = fTrace.getNext(ctx);
-
- assertEquals(1, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- // Verify seek to timestamp before first event
- seekTs = new TmfTimestamp(0, -3, 0);
- ctx = fTrace.seekEvent(seekTs);
- event = fTrace.getNext(ctx);
-
- assertEquals(1, ctx.getRank());
- assertEquals(0, new TmfTimestamp(1, -3, 0).compareTo(event.getTimestamp(), false));
-
- // Verify seek to timestamp between first and second checkpoint
- seekTs = new TmfTimestamp(50, -3, 0);
- ctx = fTrace.seekEvent(seekTs);
- event = fTrace.getNext(ctx);
-
- assertEquals(50, ctx.getRank());
- assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
-
- // Verify seek to timestamp after last event in trace
- seekTs = new TmfTimestamp(103, -3, 0);
- ctx = fTrace.seekEvent(seekTs);
- event = fTrace.getNext(ctx);
-
- assertEquals(-1, ctx.getRank());
- assertNull(event);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Adapted for TMF Trace Model 1.0
- * Alexandre Montplaisir - Port to JUnit4
- * Patrick Tasse - Updated for location in checkpoint
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpoint class.
- */
-@SuppressWarnings("javadoc")
-public class TmfCheckpointTest {
-
- // ------------------------------------------------------------------------
- // Variables
- // ------------------------------------------------------------------------
-
- private ITmfTimestamp fTimestamp1 = new TmfTimestamp();
- private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG;
- private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH;
-
- private Long aLong1 = 12345L;
- private Long aLong2 = 23456L;
- private Long aLong3 = 34567L;
- private ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
- private ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
- private ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
-
- private TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
- private TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
- private TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- @Test
- public void testTmfCheckpoint() {
- assertEquals("TmfCheckpoint", fTimestamp1, fCheckpoint1.getTimestamp());
- assertEquals("TmfCheckpoint", fLocation1, fCheckpoint1.getLocation());
- }
-
- public void testTmfLocationCopy() {
- final TmfCheckpoint checkpoint = new TmfCheckpoint(fCheckpoint1);
-
- assertEquals("TmfCheckpoint", fTimestamp1, checkpoint.getTimestamp());
- assertEquals("TmfCheckpoint", fLocation1, checkpoint.getLocation());
- }
-
- @Test
- public void testTmfLocationCopy2() {
- try {
- new TmfCheckpoint(null);
- fail("null copy");
- }
- catch (final IllegalArgumentException e) {
- // Success
- }
- catch (final Exception e) {
- fail("wrong exception");
- }
- }
-
- // ------------------------------------------------------------------------
- // compareTo
- // ------------------------------------------------------------------------
-
- @Test
- public void testCompareTo() {
- assertEquals("compareTo", 0, fCheckpoint1.compareTo(fCheckpoint1));
- assertEquals("compareTo", 1, fCheckpoint1.compareTo(fCheckpoint2));
- assertEquals("compareTo", -1, fCheckpoint1.compareTo(fCheckpoint3));
-
- assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint1));
- assertEquals("compareTo", 0, fCheckpoint2.compareTo(fCheckpoint2));
- assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint3));
-
- assertEquals("compareTo", 1, fCheckpoint3.compareTo(fCheckpoint1));
- assertEquals("compareTo", 1, fCheckpoint3.compareTo(fCheckpoint2));
- assertEquals("compareTo", 0, fCheckpoint3.compareTo(fCheckpoint3));
- }
-
- @Test
- public void testCompareToNull() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
- final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
-
- // Test the various 'null' vs. '!null' combinations
- assertEquals("compareTo", 0, checkpoint1.compareTo(fCheckpoint1));
- assertEquals("compareTo", 0, fCheckpoint1.compareTo(checkpoint1));
- assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint2));
- assertEquals("compareTo", 1, fCheckpoint2.compareTo(checkpoint1));
- assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint3));
- assertEquals("compareTo", 1, fCheckpoint3.compareTo(checkpoint1));
-
- // Test the 'null' vs. 'null' combinations
- assertEquals("compareTo", 0, checkpoint1.compareTo(checkpoint4));
- assertEquals("compareTo", 0, checkpoint4.compareTo(checkpoint1));
- assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint2));
- assertEquals("compareTo", 1, checkpoint2.compareTo(checkpoint1));
- assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint3));
- assertEquals("compareTo", 1, checkpoint3.compareTo(checkpoint1));
- }
-
- // ------------------------------------------------------------------------
- // hashCode
- // ------------------------------------------------------------------------
-
- @Test
- public void testHashCode() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
-
- assertTrue("hashCode", fCheckpoint1.hashCode() == checkpoint1.hashCode());
- assertTrue("hashCode", fCheckpoint2.hashCode() == checkpoint2.hashCode());
-
- assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
- assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
- }
-
- @Test
- public void testHashCodeNull() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
- final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
-
- assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint1.hashCode());
- assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
-
- assertTrue("hashCode", checkpoint1.hashCode() == checkpoint3.hashCode());
- assertTrue("hashCode", checkpoint2.hashCode() == checkpoint4.hashCode());
- }
-
- // ------------------------------------------------------------------------
- // equals
- // ------------------------------------------------------------------------
-
- @Test
- public void testEqualsReflexivity() {
- assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
- assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
-
- assertTrue("equals", !fCheckpoint1.equals(fCheckpoint2));
- assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
- }
-
- @Test
- public void testEqualsSymmetry() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
-
- assertTrue("equals", checkpoint1.equals(fCheckpoint1));
- assertTrue("equals", fCheckpoint1.equals(checkpoint1));
-
- assertTrue("equals", checkpoint2.equals(fCheckpoint2));
- assertTrue("equals", fCheckpoint2.equals(checkpoint2));
- }
-
- @Test
- public void testEqualsTransivity() {
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
-
- assertTrue("equals", checkpoint1.equals(checkpoint2));
- assertTrue("equals", checkpoint2.equals(checkpoint3));
- assertTrue("equals", checkpoint1.equals(checkpoint3));
- }
-
- @Test
- public void testNotEqual() {
- // Various checkpoints
- final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
- final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
- final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
- final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
- final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
-
- // Null check
- assertFalse("equals", checkpoint1.equals(null));
-
- // Different types
- assertFalse("equals", checkpoint1.equals(new TmfTimestamp()));
-
- // Null locations/location
- assertFalse("equals", checkpoint1.equals(checkpoint4));
- assertFalse("equals", checkpoint1.equals(checkpoint5));
- assertFalse("equals", checkpoint4.equals(checkpoint1));
- assertFalse("equals", checkpoint5.equals(checkpoint1));
-
- // Different locations/location
- assertFalse("equals", checkpoint1.equals(checkpoint2));
- assertFalse("equals", checkpoint1.equals(checkpoint3));
- }
-
- // ------------------------------------------------------------------------
- // toString
- // ------------------------------------------------------------------------
-
- @Test
- public void testToString() {
- final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
- ", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
- final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
- ", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
- final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
- ", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
-
- assertEquals("toString", expected1, fCheckpoint1.toString());
- assertEquals("toString", expected2, fCheckpoint2.toString());
- assertEquals("toString", expected3, fCheckpoint3.toString());
- }
-
-}
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import org.eclipse.linuxtools.tmf.core.tests.trace.location.TmfStringLocation;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTimestampLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfTimestampLocation;
import org.junit.Test;
/**
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Alexandre Montplaisir - Port to JUnit4
- * Patrick Tasse - Updated for ranks in experiment location
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
-import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfCheckpointIndexTest class.
- */
-@SuppressWarnings("javadoc")
-public class TmfExperimentCheckpointIndexTest {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final String DIRECTORY = "testfiles";
- private static final String TEST_STREAM1 = "O-Test-10K";
- private static final String TEST_STREAM2 = "E-Test-10K";
- private static final String EXPERIMENT = "MyExperiment";
- private static int NB_EVENTS = 20000;
- private static int BLOCK_SIZE = 1000;
-
- private static ITmfTrace[] fTestTraces;
- private static TmfExperimentStub fExperiment;
-
- // ------------------------------------------------------------------------
- // Housekeeping
- // ------------------------------------------------------------------------
-
- @Before
- public void setUp() {
- setupTraces();
- fExperiment = new TmfExperimentStub(EXPERIMENT, fTestTraces, BLOCK_SIZE);
- fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
- }
-
- @After
- public void tearDown() {
- fExperiment.dispose();
- fExperiment = null;
- for (ITmfTrace trace : fTestTraces) {
- trace.dispose();
- }
- fTestTraces = null;
- }
-
- private static void setupTraces() {
- final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
- final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
-
- fTestTraces = new ITmfTrace[2];
- try {
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true);
- fTestTraces[0] = trace1;
- location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
- test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true);
- fTestTraces[1] = trace2;
- } catch (final TmfTraceException e) {
- e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
- }
- }
-
- // ------------------------------------------------------------------------
- // Verify checkpoints
- // ------------------------------------------------------------------------
-
- @Test
- public void testTmfTraceIndexing() {
- assertEquals("getCacheSize", BLOCK_SIZE, fExperiment.getCacheSize());
- assertEquals("getTraceSize", NB_EVENTS, fExperiment.getNbEvents());
- assertEquals("getRange-start", 1, fExperiment.getTimeRange().getStartTime().getValue());
- assertEquals("getRange-end", NB_EVENTS, fExperiment.getTimeRange().getEndTime().getValue());
- assertEquals("getStartTime", 1, fExperiment.getStartTime().getValue());
- assertEquals("getEndTime", NB_EVENTS, fExperiment.getEndTime().getValue());
-
- List<ITmfCheckpoint> checkpoints = fExperiment.getIndexer().getCheckpoints();
- int pageSize = fExperiment.getCacheSize();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
-
- // Validate that each checkpoint points to the right event
- for (int i = 0; i < checkpoints.size(); i++) {
- ITmfCheckpoint checkpoint = checkpoints.get(i);
- ITmfLocation location = checkpoint.getLocation();
- ITmfContext context = fExperiment.seekEvent(location);
- ITmfEvent event = fExperiment.parseEvent(context);
- assertTrue(context.getRank() == i * pageSize);
- assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
- }
- }
-
- // ------------------------------------------------------------------------
- // Streaming
- // ------------------------------------------------------------------------
-
- @Test
- public void testGrowingIndex() {
- ITmfTrace[] testTraces = new TmfTraceStub[2];
- try {
- URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null);
- File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false);
- testTraces[0] = trace1;
- location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null);
- test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false);
- testTraces[1] = trace2;
- } catch (final TmfTraceException e) {
- e.printStackTrace();
- } catch (final URISyntaxException e) {
- e.printStackTrace();
- } catch (final IOException e) {
- e.printStackTrace();
- }
-
- TmfExperimentStub experiment = new TmfExperimentStub(EXPERIMENT, testTraces, BLOCK_SIZE);
- int pageSize = experiment.getCacheSize();
-
- // Build the first half of the index
- TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(1, -3), new TmfTimestamp(NB_EVENTS / 2 - 1, -3));
- experiment.getIndexer().buildIndex(0, range, true);
-
- // Validate that each checkpoint points to the right event
- List<ITmfCheckpoint> checkpoints = experiment.getIndexer().getCheckpoints();
- assertTrue("Checkpoints exist", checkpoints != null);
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE / 2, checkpoints.size());
-
- // Build the second half of the index
- experiment.getIndexer().buildIndex(NB_EVENTS / 2, TmfTimeRange.ETERNITY, true);
-
- // Validate that each checkpoint points to the right event
- assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
- for (int i = 0; i < checkpoints.size(); i++) {
- ITmfCheckpoint checkpoint = checkpoints.get(i);
- ITmfLocation location = checkpoint.getLocation();
- ITmfContext context = experiment.seekEvent(location);
- ITmfEvent event = experiment.parseEvent(context);
- assertTrue(context.getRank() == i * pageSize);
- assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
- assertEquals("Checkpoint value", i * pageSize + 1, checkpoint.getTimestamp().getValue());
- }
-
- /* Clean up (since we didn't use the class-specific fixtures) */
- experiment.dispose();
- for (ITmfTrace trace : testTraces) {
- trace.dispose();
- }
- }
-
-}
\ No newline at end of file
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import org.junit.Before;
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
final File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true);
+ final TmfTraceStub trace = new TmfTraceStub(test.getPath(), 0, true, null, null);
fTestTraces[0] = trace;
} catch (final TmfTraceException e) {
e.printStackTrace();
@Test
public void testProcessRequestForNbEvents() throws InterruptedException {
- final int blockSize = 100;
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- requestedEvents.add(event);
- }
- };
- fExperiment.sendRequest(request);
- request.waitForCompletion();
-
- assertEquals("nbEvents", nbEvents, requestedEvents.size());
- assertTrue("isCompleted", request.isCompleted());
- assertFalse("isCancelled", request.isCancelled());
-
- // Ensure that we have distinct events.
- // Don't go overboard: we are not validating the stub!
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("Distinct events", i+1, requestedEvents.get(i).getTimestamp().getValue());
- }
- }
-
- @Test
- public void testProcessRequestForNbEvents2() throws InterruptedException {
- final int blockSize = 2 * NB_EVENTS;
- final int nbEvents = 1000;
- final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
-
- final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testProcessRequestForAllEvents() throws InterruptedException {
final int nbEvents = TmfDataRequest.ALL_DATA;
- final int blockSize = 1;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final long nbExpectedEvents = NB_EVENTS;
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testCancel() throws InterruptedException {
- final int nbEvents = NB_EVENTS;
- final int blockSize = BLOCK_SIZE;
+ final int nbEvents = NB_EVENTS;
+ final int limit = BLOCK_SIZE;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
int nbRead = 0;
+
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
requestedEvents.add(event);
- if (++nbRead == blockSize) {
+ if (++nbRead == limit) {
cancel();
}
}
+
@Override
public void handleCancel() {
- if (requestedEvents.size() < blockSize) {
+ if (requestedEvents.size() < limit) {
System.out.println("aie");
}
}
fExperiment.sendRequest(request);
request.waitForCompletion();
- assertEquals("nbEvents", blockSize, requestedEvents.size());
+ assertEquals("nbEvents", limit, requestedEvents.size());
assertTrue("isCompleted", request.isCompleted());
assertTrue("isCancelled", request.isCancelled());
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Alexandre Montplaisir - Port to JUnit4
- * Patrick Tasse - Add tests for TmfExperimentLocation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
-import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTimestampLocation;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test suite for the TmfLocation class.
- */
-@SuppressWarnings("javadoc")
-public class TmfLocationTest {
-
- // ------------------------------------------------------------------------
- // Variables
- // ------------------------------------------------------------------------
-
- private String aString = "some location";
- private Long aLong = 12345L;
- private TmfTimestamp aTimestamp = new TmfTimestamp();
- private TmfLocationArray aLocationArray;
-
- private TmfStringLocation fLocation1;
- private TmfStringLocation fLocation2;
- private TmfLongLocation fLocation3;
- private TmfTimestampLocation fLocation4;
- private TmfExperimentLocation fExpLocation;
-
- // ------------------------------------------------------------------------
- // Housekeeping
- // ------------------------------------------------------------------------
-
- @Before
- public void setUp() {
- fLocation1 = new TmfStringLocation((String) null);
- fLocation2 = new TmfStringLocation(aString);
- fLocation3 = new TmfLongLocation(aLong);
- fLocation4 = new TmfTimestampLocation(aTimestamp);
- aLocationArray = new TmfLocationArray(
- new ITmfLocation[] { fLocation1, fLocation2, fLocation3, fLocation4 },
- new long[] { 1, 2, 3, 4 }
- );
- fExpLocation = new TmfExperimentLocation(aLocationArray);
- }
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- @Test
- public void testTmfLocation() {
- assertNull("TmfLocation", fLocation1.getLocationInfo());
- assertEquals("TmfLocation", aString, fLocation2.getLocationInfo());
- assertEquals("TmfLocation", aLong, fLocation3.getLocationInfo());
- assertEquals("TmfLocation", aTimestamp, fLocation4.getLocationInfo());
- assertEquals("TmfLocation", aLocationArray, fExpLocation.getLocationInfo());
- }
-
- @Test
- public void testTmfLocationCopy() {
- TmfStringLocation location1 = new TmfStringLocation(fLocation1);
- TmfStringLocation location2 = new TmfStringLocation(fLocation2);
- TmfLongLocation location3 = new TmfLongLocation(fLocation3);
- TmfTimestampLocation location4 = new TmfTimestampLocation(fLocation4);
- TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
-
- assertNull("TmfLocation", location1.getLocationInfo());
- assertEquals("TmfLocation", aString, location2.getLocationInfo());
- assertEquals("TmfLocation", aLong, location3.getLocationInfo());
- assertEquals("TmfLocation", aTimestamp, location4.getLocationInfo());
- assertEquals("TmfLocation", aLocationArray, expLocation.getLocationInfo());
- }
-
- // ------------------------------------------------------------------------
- // hashCode
- // ------------------------------------------------------------------------
-
- @Test
- public void testHashCode() {
- TmfStringLocation location1 = new TmfStringLocation((String) null);
- TmfStringLocation location2 = new TmfStringLocation(aString);
- TmfLongLocation location3 = new TmfLongLocation(aLong);
- TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
- TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
- TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
- TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
- TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
- TmfLocationArray locationArray3 = new TmfLocationArray(
- new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
- new long[] { 1, 2, 3 }
- );
- TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
-
- assertTrue("hashCode", fLocation1.hashCode() == location1.hashCode());
- assertTrue("hashCode", fLocation2.hashCode() == location2.hashCode());
- assertTrue("hashCode", fLocation3.hashCode() == location3.hashCode());
- assertTrue("hashCode", fExpLocation.hashCode() == expLocation.hashCode());
-
- assertTrue("hashCode", fLocation2.hashCode() != location3.hashCode());
- assertTrue("hashCode", fLocation3.hashCode() != location2.hashCode());
- assertTrue("hashCode", fExpLocation.hashCode() != expLocation1.hashCode());
- assertTrue("hashCode", fExpLocation.hashCode() != expLocation2.hashCode());
- assertTrue("hashCode", fExpLocation.hashCode() != expLocation3.hashCode());
- }
-
- // ------------------------------------------------------------------------
- // toEquals
- // ------------------------------------------------------------------------
-
- private static class TmfLocation2 extends TmfStringLocation {
- public TmfLocation2(String location) {
- super(location);
- }
- }
-
- @Test
- public void testEqualsWrongTypes() {
- ITmfLocation location1 = new TmfStringLocation(aString);
- TmfLocation2 location2 = new TmfLocation2(aString);
-
- assertFalse("equals", location1.equals(location2));
- assertFalse("equals", location2.equals(location1));
- }
-
- @Test
- public void testEqualsWithNulls() {
- TmfStringLocation location1 = new TmfStringLocation(aString);
- TmfStringLocation location2 = new TmfStringLocation((String) null);
-
- assertFalse("equals", location1.equals(location2));
- assertFalse("equals", location2.equals(location1));
- }
-
- @Test
- public void testEqualsReflexivity() {
- assertTrue("equals", fLocation2.equals(fLocation2));
- assertTrue("equals", fLocation3.equals(fLocation3));
- assertTrue("equals", fExpLocation.equals(fExpLocation));
-
- assertTrue("equals", !fLocation2.equals(fLocation3));
- assertTrue("equals", !fLocation3.equals(fLocation2));
- TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
- TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
- TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
- TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
- TmfLocationArray locationArray3 = new TmfLocationArray(
- new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
- new long[] { 1, 2, 3 }
- );
- TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
- assertTrue("equals", !fExpLocation.equals(expLocation1));
- assertTrue("equals", !expLocation1.equals(fExpLocation));
- assertTrue("equals", !fExpLocation.equals(expLocation2));
- assertTrue("equals", !expLocation2.equals(fExpLocation));
- assertTrue("equals", !fExpLocation.equals(expLocation3));
- assertTrue("equals", !expLocation3.equals(fExpLocation));
- }
-
- @Test
- public void testEqualsSymmetry() {
- TmfStringLocation location2 = new TmfStringLocation(aString);
- TmfLongLocation location3 = new TmfLongLocation(aLong);
- TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
-
- assertTrue("equals", location2.equals(fLocation2));
- assertTrue("equals", fLocation2.equals(location2));
-
- assertTrue("equals", location3.equals(fLocation3));
- assertTrue("equals", fLocation3.equals(location3));
-
- assertTrue("equals", expLocation.equals(fExpLocation));
- assertTrue("equals", fExpLocation.equals(expLocation));
- }
-
- @Test
- public void testEqualsTransivity() {
- TmfStringLocation location1 = new TmfStringLocation(aString);
- TmfStringLocation location2 = new TmfStringLocation(aString);
- TmfStringLocation location3 = new TmfStringLocation(aString);
- TmfExperimentLocation expLocation1 = new TmfExperimentLocation(aLocationArray);
- TmfExperimentLocation expLocation2 = new TmfExperimentLocation(aLocationArray);
- TmfExperimentLocation expLocation3 = new TmfExperimentLocation(aLocationArray);
-
- assertTrue("equals", location1.equals(location2));
- assertTrue("equals", location2.equals(location3));
- assertTrue("equals", location3.equals(location1));
- assertTrue("equals", expLocation1.equals(expLocation2));
- assertTrue("equals", expLocation2.equals(expLocation3));
- assertTrue("equals", expLocation3.equals(expLocation1));
- }
-
- @Test
- public void testEqualsNull() {
- assertTrue("equals", !fLocation2.equals(null));
- assertTrue("equals", !fLocation2.equals(null));
- assertTrue("equals", !fExpLocation.equals(null));
- }
-
- // ------------------------------------------------------------------------
- // toString
- // ------------------------------------------------------------------------
-
- @Test
- public void testToString() {
- String str = "some location";
- Long lng = 12345L;
- TmfTimestamp ts = new TmfTimestamp();
-
- TmfStringLocation location1 = new TmfStringLocation(str);
- TmfLongLocation location2 = new TmfLongLocation(lng);
- TmfTimestampLocation location3 = new TmfTimestampLocation(ts);
- TmfExperimentLocation expLocation = new TmfExperimentLocation(aLocationArray);
-
- String expected1 = "TmfStringLocation [fLocationInfo=" + str + "]";
- String expected2 = "TmfLongLocation [fLocationInfo=" + lng + "]";
- String expected3 = "TmfTimestampLocation [fLocationInfo=" + ts + "]";
- String expected4 = "TmfExperimentLocation [" + aLocationArray + "]";
-
- assertEquals("toString", expected1, location1.toString());
- assertEquals("toString", expected2, location2.toString());
- assertEquals("toString", expected3, location3.toString());
- assertEquals("toString", expected4, expLocation.toString());
- }
-
-}
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import org.junit.AfterClass;
URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
File test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true);
+ final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null);
traces[0] = trace1;
location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
test = new File(FileLocator.toFileURL(location).toURI());
- final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true);
+ final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null);
traces[1] = trace2;
return traces;
@Test
public void testProcessRequestForNbEvents() throws InterruptedException {
- final int blockSize = 100;
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- requestedEvents.add(event);
- }
- };
- fExperiment.sendRequest(request);
- request.waitForCompletion();
-
- assertEquals("nbEvents", nbEvents, requestedEvents.size());
- assertTrue("isCompleted", request.isCompleted());
- assertFalse("isCancelled", request.isCancelled());
-
- // Ensure that we have distinct events.
- // Don't go overboard: we are not validating the stub!
- for (int i = 0; i < nbEvents; i++) {
- assertEquals("Distinct events", i+1, requestedEvents.get(i).getTimestamp().getValue());
- }
- }
-
- @Test
- public void testProcessRequestForNbEvents2() throws InterruptedException {
- final int blockSize = 2 * NB_EVENTS;
- final int nbEvents = 1000;
- final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
-
- final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testProcessRequestForAllEvents() throws InterruptedException {
final int nbEvents = TmfDataRequest.ALL_DATA;
- final int blockSize = 1;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final long nbExpectedEvents = NB_EVENTS;
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testCancel() throws InterruptedException {
final int nbEvents = NB_EVENTS;
- final int blockSize = BLOCK_SIZE;
+ final int limit = BLOCK_SIZE;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
int nbRead = 0;
+
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
requestedEvents.add(event);
- if (++nbRead == blockSize) {
+ if (++nbRead == limit) {
cancel();
}
}
- @Override
- public void handleCancel() {
- if (requestedEvents.size() < blockSize) {
- System.out.println("aie");
- }
- }
};
fExperiment.sendRequest(request);
request.waitForCompletion();
- assertEquals("nbEvents", blockSize, requestedEvents.size());
+ assertEquals("nbEvents", limit, requestedEvents.size());
assertTrue("isCompleted", request.isCompleted());
assertTrue("isCancelled", request.isCancelled());
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.tests.trace;
-
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
-
-/**
- * <b><u>TmfStringLocation</u></b>
- * <p>
- * Implement me. Please.
- * <p>
- */
-public class TmfStringLocation extends TmfLocation {
-
- /**
- * @param location the concrete trace location
- */
- public TmfStringLocation(String location) {
- super(location);
- }
-
- /**
- * @param other the other location
- */
- public TmfStringLocation(TmfStringLocation other) {
- super(other.getLocationInfo());
- }
-
- @Override
- public String getLocationInfo() {
- return (String) super.getLocationInfo();
- }
-
-}
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import org.junit.After;
import org.junit.Before;
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.toURI().getPath(), BLOCK_SIZE);
+ fTrace = new TmfTraceStub(test.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
fTrace.indexTrace(true);
} catch (final TmfTraceException e) {
e.printStackTrace();
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath());
+ TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
trace.indexTrace(true);
assertEquals("getType", ITmfEvent.class, trace.getType());
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), 0);
+ TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), 0, false, null, null);
trace.indexTrace(true);
assertEquals("getType", ITmfEvent.class, trace.getType());
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE);
+ TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
trace.indexTrace(true);
assertEquals("getType", ITmfEvent.class, trace.getType());
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, null);
+ TmfTraceStub trace = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, false, null, null);
trace.indexTrace(true);
assertEquals("getType", ITmfEvent.class, trace.getType());
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
File testfile = new File(FileLocator.toFileURL(location).toURI());
- TmfTraceStub original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, new TmfCheckpointIndexer(null));
+ TmfTraceStub original = new TmfTraceStub(testfile.toURI().getPath(), BLOCK_SIZE, false, new TmfCheckpointIndexer(null), null);
TmfTraceStub trace = new TmfTraceStub(original);
trace.indexTrace(true);
@Test
public void testProcessEventRequestForAllEvents() throws InterruptedException {
- final int blockSize = 1;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testProcessEventRequestForNbEvents() throws InterruptedException {
- final int blockSize = 100;
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testProcessEventRequestForSomeEvents() throws InterruptedException {
- final int blockSize = 1;
final long startTime = 100;
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testProcessEventRequestForOtherEvents() throws InterruptedException {
- final int blockSize = 1;
final int startIndex = 99;
final long startTime = 100;
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(startTime, SCALE), TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, startIndex, nbEvents, blockSize) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, startIndex, nbEvents, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
final int nbEvents = 1000;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
- final TmfDataRequest request = new TmfDataRequest(ITmfEvent.class, startIndex, nbEvents) {
+ final TmfDataRequest request = new TmfDataRequest(ITmfEvent.class,
+ startIndex,
+ nbEvents,
+ TmfDataRequest.ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
@Test
public void testCancel() throws InterruptedException {
+ final int limit = BLOCK_SIZE;
final Vector<ITmfEvent> requestedEvents = new Vector<ITmfEvent>();
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
- final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ final TmfEventRequest request = new TmfEventRequest(ITmfEvent.class,
+ range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
int nbRead = 0;
+
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
requestedEvents.add(event);
- if (++nbRead == BLOCK_SIZE) {
+ if (++nbRead == limit) {
cancel();
}
}
providers[0].sendRequest(request);
request.waitForCompletion();
- assertEquals("nbEvents", BLOCK_SIZE, requestedEvents.size());
+ assertEquals("nbEvents", limit, requestedEvents.size());
assertTrue("isCompleted", request.isCompleted());
assertTrue("isCancelled", request.isCancelled());
}
assertFalse ("Open trace", fTrace == null);
assertEquals("getType", ITmfEvent.class, fTrace.getType());
assertNull ("getResource", fTrace.getResource());
- assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
assertEquals("getStreamingInterval", 0, fTrace.getStreamingInterval());
assertEquals("getName", TEST_STREAM, fTrace.getName());
try {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
testfile = new File(FileLocator.toFileURL(location).toURI());
- trace = new TmfTraceStub(testfile.toURI().getPath());
+ trace = new TmfTraceStub(testfile.toURI().getPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null, null);
// verify initial values
TmfTimestamp defaultInitRange = new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
assertEquals("getInitialRangeOffset", defaultInitRange, trace.getInitialRangeOffset());
TmfTimestamp initRange = new TmfTimestamp(5, ITmfTimestamp.MILLISECOND_SCALE);
assertEquals("getInitialRangeOffset", initRange, trace.getInitialRangeOffset());
}
+
+ /**
+ * Run the String getHostId() method test
+ */
+ @Test
+ public void testTraceHostId() {
+ String a = fTrace.getHostId();
+ assertEquals("A-Test-10K", a);
+ }
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TmfCheckpointIndexTest.class,
+ TmfCheckpointIndexTest2.class,
+ TmfCheckpointTest.class,
+ TmfExperimentCheckpointIndexTest.class,
+})
+public class AllTests {}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adapted for TMF Trace Model 1.0
+ * Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexTest class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointIndexTest {
+
+ // ------------------------------------------------------------------------
+ // Variables
+ // ------------------------------------------------------------------------
+
+ private static final String DIRECTORY = "testfiles";
+ private static final String TEST_STREAM = "A-Test-10K";
+ private static final int BLOCK_SIZE = 100;
+ private static final int NB_EVENTS = 10000;
+ private static TestTrace fTrace = null;
+ private static EmptyTestTrace fEmptyTrace = null;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ @Before
+ public void setUp() {
+ setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+ }
+
+ @After
+ public void tearDown() {
+ fTrace.dispose();
+ fTrace = null;
+ fEmptyTrace.dispose();
+ fEmptyTrace = null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper classes
+ // ------------------------------------------------------------------------
+
+ private static class TestIndexer extends TmfCheckpointIndexer {
+ @SuppressWarnings({ })
+ public TestIndexer(TestTrace testTrace) {
+ super(testTrace, BLOCK_SIZE);
+ }
+ @SuppressWarnings({ })
+ public TestIndexer(EmptyTestTrace testTrace) {
+ super(testTrace, BLOCK_SIZE);
+ }
+ public List<ITmfCheckpoint> getCheckpoints() {
+ return getTraceIndex();
+ }
+ }
+
+ private class TestTrace extends TmfTraceStub {
+ public TestTrace(String path, int blockSize) throws TmfTraceException {
+ super(path, blockSize, false, null, null);
+ setIndexer(new TestIndexer(this));
+ }
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+
+ private class EmptyTestTrace extends TmfEmptyTraceStub {
+ public EmptyTestTrace() {
+ super();
+ setIndexer(new TestIndexer(this));
+ }
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
+ private synchronized void setupTrace(final String path) {
+ if (fTrace == null) {
+ try {
+ final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
+ final File test = new File(FileLocator.toFileURL(location).toURI());
+ fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+ fTrace.indexTrace(true);
+ } catch (final TmfTraceException e) {
+ e.printStackTrace();
+ } catch (final URISyntaxException e) {
+ e.printStackTrace();
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (fEmptyTrace == null) {
+ fEmptyTrace = new EmptyTestTrace();
+ fEmptyTrace.indexTrace(true);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Verify checkpoints
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testTmfTraceIndexing() {
+ assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
+ assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
+ assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", NB_EVENTS, fTrace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, fTrace.getStartTime().getValue());
+ assertEquals("getEndTime", NB_EVENTS, fTrace.getEndTime().getValue());
+
+ List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
+ int pageSize = fTrace.getCacheSize();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+
+ // Validate that each checkpoint points to the right event
+ for (int i = 0; i < checkpoints.size(); i++) {
+ ITmfCheckpoint checkpoint = checkpoints.get(i);
+ TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
+ ITmfEvent event = fTrace.parseEvent(context);
+ assertTrue(context.getRank() == i * pageSize);
+ assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+ }
+ }
+
+ @Test
+ public void testEmptyTmfTraceIndexing() {
+ assertEquals("getCacheSize", ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, fEmptyTrace.getCacheSize());
+ assertEquals("getTraceSize", 0, fEmptyTrace.getNbEvents());
+ assertEquals("getRange-start", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getStartTime());
+ assertEquals("getRange-end", TmfTimestamp.BIG_BANG, fEmptyTrace.getTimeRange().getEndTime());
+ assertEquals("getStartTime", TmfTimestamp.BIG_BANG, fEmptyTrace.getStartTime());
+ assertEquals("getEndTime", TmfTimestamp.BIG_BANG, fEmptyTrace.getEndTime());
+
+ List<ITmfCheckpoint> checkpoints = fEmptyTrace.getIndexer().getCheckpoints();
+ int pageSize = fEmptyTrace.getCacheSize();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", 0, checkpoints.size());
+
+ // Validate that each checkpoint points to the right event
+ for (int i = 0; i < checkpoints.size(); i++) {
+ ITmfCheckpoint checkpoint = checkpoints.get(i);
+ TmfContext context = new TmfContext(checkpoint.getLocation(), i * pageSize);
+ ITmfEvent event = fEmptyTrace.parseEvent(context);
+ assertTrue(context.getRank() == i * pageSize);
+ assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ * Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfEmptyTraceStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexer class (events with same
+ * timestamp around checkpoint).
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointIndexTest2 {
+
+ // ------------------------------------------------------------------------
+ // Variables
+ // ------------------------------------------------------------------------
+
+ private static final String DIRECTORY = "testfiles";
+ // Trace has 3 events at t=101 at rank 99, 100, 101
+ // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
+ private static final String TEST_STREAM = "A-Test-10K-2";
+ private static final int BLOCK_SIZE = 100;
+ private static final int NB_EVENTS = 702;
+ private static TestTrace fTrace = null;
+ private static EmptyTestTrace fEmptyTrace = null;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ @Before
+ public void setUp() {
+ setupTrace(DIRECTORY + File.separator + TEST_STREAM);
+ }
+
+ @After
+ public void tearDown() {
+ fTrace.dispose();
+ fTrace = null;
+ fEmptyTrace.dispose();
+ fEmptyTrace = null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper classes
+ // ------------------------------------------------------------------------
+
+ private static class TestIndexer extends TmfCheckpointIndexer {
+ @SuppressWarnings({ })
+ public TestIndexer(TestTrace testTrace) {
+ super(testTrace, BLOCK_SIZE);
+ }
+ @SuppressWarnings({ })
+ public TestIndexer(EmptyTestTrace testTrace) {
+ super(testTrace, BLOCK_SIZE);
+ }
+ public List<ITmfCheckpoint> getCheckpoints() {
+ return getTraceIndex();
+ }
+ }
+
+ private class TestTrace extends TmfTraceStub {
+ public TestTrace(String path, int blockSize) throws TmfTraceException {
+ super(path, blockSize, false, null, null);
+ setIndexer(new TestIndexer(this));
+ }
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+
+ private class EmptyTestTrace extends TmfEmptyTraceStub {
+ public EmptyTestTrace() {
+ super();
+ setIndexer(new TestIndexer(this));
+ }
+ @Override
+ public TestIndexer getIndexer() {
+ return (TestIndexer) super.getIndexer();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
+ private synchronized void setupTrace(final String path) {
+ if (fTrace == null) {
+ try {
+ final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
+ final File test = new File(FileLocator.toFileURL(location).toURI());
+ fTrace = new TestTrace(test.toURI().getPath(), BLOCK_SIZE);
+ fTrace.indexTrace(true);
+ } catch (final TmfTraceException e) {
+ e.printStackTrace();
+ } catch (final URISyntaxException e) {
+ e.printStackTrace();
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (fEmptyTrace == null) {
+ fEmptyTrace = new EmptyTestTrace();
+ fEmptyTrace.indexTrace(true);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Verify checkpoints
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testTmfTraceMultiTimestamps() {
+ assertEquals("getCacheSize", BLOCK_SIZE, fTrace.getCacheSize());
+ assertEquals("getTraceSize", NB_EVENTS, fTrace.getNbEvents());
+ assertEquals("getRange-start", 1, fTrace.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", 102, fTrace.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, fTrace.getStartTime().getValue());
+ assertEquals("getEndTime", 102, fTrace.getEndTime().getValue());
+
+ List<ITmfCheckpoint> checkpoints = fTrace.getIndexer().getCheckpoints();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE + 1, checkpoints.size());
+
+ // Trace has 3 events with same timestamp (ts=101) at rank 99, 100, 101
+
+ // Verify that the event at rank=99 is returned when seeking to ts=101 (first event with this timestamp)
+ // and not the event at checkpoint boundary
+ TmfTimestamp seekTs = new TmfTimestamp(101, -3, 0);
+ ITmfContext ctx = fTrace.seekEvent(seekTs);
+ ITmfEvent event = fTrace.getNext(ctx);
+
+ assertEquals(99, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ event = fTrace.getNext(ctx);
+
+ assertEquals(100, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ event = fTrace.getNext(ctx);
+
+ assertEquals(101, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ // Trace has events with same timestamp (ts=102) for ranks 102..702 -> 2 checkpoints with same timestamp are created
+ // Verify that the event at rank=102 is returned when seeking to ts=102 (first event with this timestamp)
+ // and not the event at checkpoint boundary
+ seekTs = new TmfTimestamp(102, -3, 0);
+ ctx = fTrace.seekEvent(seekTs);
+ event = fTrace.getNext(ctx);
+
+ assertEquals(102, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ // Verify seek to first checkpoint
+ seekTs = new TmfTimestamp(1, -3, 0);
+ ctx = fTrace.seekEvent(seekTs);
+ event = fTrace.getNext(ctx);
+
+ assertEquals(1, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ // Verify seek to timestamp before first event
+ seekTs = new TmfTimestamp(0, -3, 0);
+ ctx = fTrace.seekEvent(seekTs);
+ event = fTrace.getNext(ctx);
+
+ assertEquals(1, ctx.getRank());
+ assertEquals(0, new TmfTimestamp(1, -3, 0).compareTo(event.getTimestamp(), false));
+
+ // Verify seek to timestamp between first and second checkpoint
+ seekTs = new TmfTimestamp(50, -3, 0);
+ ctx = fTrace.seekEvent(seekTs);
+ event = fTrace.getNext(ctx);
+
+ assertEquals(50, ctx.getRank());
+ assertEquals(0, seekTs.compareTo(event.getTimestamp(), false));
+
+ // Verify seek to timestamp after last event in trace
+ seekTs = new TmfTimestamp(103, -3, 0);
+ ctx = fTrace.seekEvent(seekTs);
+ event = fTrace.getNext(ctx);
+
+ assertEquals(-1, ctx.getRank());
+ assertNull(event);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adapted for TMF Trace Model 1.0
+ * Alexandre Montplaisir - Port to JUnit4
+ * Patrick Tasse - Updated for location in checkpoint
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpoint;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpoint class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfCheckpointTest {
+
+ // ------------------------------------------------------------------------
+ // Variables
+ // ------------------------------------------------------------------------
+
+ private ITmfTimestamp fTimestamp1 = new TmfTimestamp();
+ private ITmfTimestamp fTimestamp2 = TmfTimestamp.BIG_BANG;
+ private ITmfTimestamp fTimestamp3 = TmfTimestamp.BIG_CRUNCH;
+
+ private Long aLong1 = 12345L;
+ private Long aLong2 = 23456L;
+ private Long aLong3 = 34567L;
+ private ITmfLocation fLocation1 = new TmfLongLocation(aLong1);
+ private ITmfLocation fLocation2 = new TmfLongLocation(aLong2);
+ private ITmfLocation fLocation3 = new TmfLongLocation(aLong3);
+
+ private TmfCheckpoint fCheckpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
+ private TmfCheckpoint fCheckpoint2 = new TmfCheckpoint(fTimestamp2, fLocation2);
+ private TmfCheckpoint fCheckpoint3 = new TmfCheckpoint(fTimestamp3, fLocation3);
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testTmfCheckpoint() {
+ assertEquals("TmfCheckpoint", fTimestamp1, fCheckpoint1.getTimestamp());
+ assertEquals("TmfCheckpoint", fLocation1, fCheckpoint1.getLocation());
+ }
+
+ public void testTmfLocationCopy() {
+ final TmfCheckpoint checkpoint = new TmfCheckpoint(fCheckpoint1);
+
+ assertEquals("TmfCheckpoint", fTimestamp1, checkpoint.getTimestamp());
+ assertEquals("TmfCheckpoint", fLocation1, checkpoint.getLocation());
+ }
+
+ @Test
+ public void testTmfLocationCopy2() {
+ try {
+ new TmfCheckpoint(null);
+ fail("null copy");
+ }
+ catch (final IllegalArgumentException e) {
+ // Success
+ }
+ catch (final Exception e) {
+ fail("wrong exception");
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // compareTo
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testCompareTo() {
+ assertEquals("compareTo", 0, fCheckpoint1.compareTo(fCheckpoint1));
+ assertEquals("compareTo", 1, fCheckpoint1.compareTo(fCheckpoint2));
+ assertEquals("compareTo", -1, fCheckpoint1.compareTo(fCheckpoint3));
+
+ assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint1));
+ assertEquals("compareTo", 0, fCheckpoint2.compareTo(fCheckpoint2));
+ assertEquals("compareTo", -1, fCheckpoint2.compareTo(fCheckpoint3));
+
+ assertEquals("compareTo", 1, fCheckpoint3.compareTo(fCheckpoint1));
+ assertEquals("compareTo", 1, fCheckpoint3.compareTo(fCheckpoint2));
+ assertEquals("compareTo", 0, fCheckpoint3.compareTo(fCheckpoint3));
+ }
+
+ @Test
+ public void testCompareToNull() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(null, fLocation2);
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(null, fLocation3);
+ final TmfCheckpoint checkpoint4 = new TmfCheckpoint(null, fLocation1);
+
+ // Test the various 'null' vs. '!null' combinations
+ assertEquals("compareTo", 0, checkpoint1.compareTo(fCheckpoint1));
+ assertEquals("compareTo", 0, fCheckpoint1.compareTo(checkpoint1));
+ assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint2));
+ assertEquals("compareTo", 1, fCheckpoint2.compareTo(checkpoint1));
+ assertEquals("compareTo", -1, checkpoint1.compareTo(fCheckpoint3));
+ assertEquals("compareTo", 1, fCheckpoint3.compareTo(checkpoint1));
+
+ // Test the 'null' vs. 'null' combinations
+ assertEquals("compareTo", 0, checkpoint1.compareTo(checkpoint4));
+ assertEquals("compareTo", 0, checkpoint4.compareTo(checkpoint1));
+ assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint2));
+ assertEquals("compareTo", 1, checkpoint2.compareTo(checkpoint1));
+ assertEquals("compareTo", -1, checkpoint1.compareTo(checkpoint3));
+ assertEquals("compareTo", 1, checkpoint3.compareTo(checkpoint1));
+ }
+
+ // ------------------------------------------------------------------------
+ // hashCode
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testHashCode() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
+
+ assertTrue("hashCode", fCheckpoint1.hashCode() == checkpoint1.hashCode());
+ assertTrue("hashCode", fCheckpoint2.hashCode() == checkpoint2.hashCode());
+
+ assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
+ assertTrue("hashCode", fCheckpoint2.hashCode() != checkpoint1.hashCode());
+ }
+
+ @Test
+ public void testHashCodeNull() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(null, fLocation1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp1, null);
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint1);
+ final TmfCheckpoint checkpoint4 = new TmfCheckpoint(checkpoint2);
+
+ assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint1.hashCode());
+ assertTrue("hashCode", fCheckpoint1.hashCode() != checkpoint2.hashCode());
+
+ assertTrue("hashCode", checkpoint1.hashCode() == checkpoint3.hashCode());
+ assertTrue("hashCode", checkpoint2.hashCode() == checkpoint4.hashCode());
+ }
+
+ // ------------------------------------------------------------------------
+ // equals
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testEqualsReflexivity() {
+ assertTrue("equals", fCheckpoint1.equals(fCheckpoint1));
+ assertTrue("equals", fCheckpoint2.equals(fCheckpoint2));
+
+ assertTrue("equals", !fCheckpoint1.equals(fCheckpoint2));
+ assertTrue("equals", !fCheckpoint2.equals(fCheckpoint1));
+ }
+
+ @Test
+ public void testEqualsSymmetry() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fCheckpoint2);
+
+ assertTrue("equals", checkpoint1.equals(fCheckpoint1));
+ assertTrue("equals", fCheckpoint1.equals(checkpoint1));
+
+ assertTrue("equals", checkpoint2.equals(fCheckpoint2));
+ assertTrue("equals", fCheckpoint2.equals(checkpoint2));
+ }
+
+ @Test
+ public void testEqualsTransivity() {
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fCheckpoint1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(checkpoint1);
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(checkpoint2);
+
+ assertTrue("equals", checkpoint1.equals(checkpoint2));
+ assertTrue("equals", checkpoint2.equals(checkpoint3));
+ assertTrue("equals", checkpoint1.equals(checkpoint3));
+ }
+
+ @Test
+ public void testNotEqual() {
+ // Various checkpoints
+ final TmfCheckpoint checkpoint1 = new TmfCheckpoint(fTimestamp1, fLocation1);
+ final TmfCheckpoint checkpoint2 = new TmfCheckpoint(fTimestamp2, fLocation1);
+ final TmfCheckpoint checkpoint3 = new TmfCheckpoint(fTimestamp1, fLocation2);
+ final TmfCheckpoint checkpoint4 = new TmfCheckpoint(fTimestamp1, null);
+ final TmfCheckpoint checkpoint5 = new TmfCheckpoint(null, fLocation1);
+
+ // Null check
+ assertFalse("equals", checkpoint1.equals(null));
+
+ // Different types
+ assertFalse("equals", checkpoint1.equals(new TmfTimestamp()));
+
+ // Null locations/location
+ assertFalse("equals", checkpoint1.equals(checkpoint4));
+ assertFalse("equals", checkpoint1.equals(checkpoint5));
+ assertFalse("equals", checkpoint4.equals(checkpoint1));
+ assertFalse("equals", checkpoint5.equals(checkpoint1));
+
+ // Different locations/location
+ assertFalse("equals", checkpoint1.equals(checkpoint2));
+ assertFalse("equals", checkpoint1.equals(checkpoint3));
+ }
+
+ // ------------------------------------------------------------------------
+ // toString
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testToString() {
+ final String expected1 = "TmfCheckpoint [fLocation=" + fCheckpoint1.getLocation() +
+ ", fTimestamp=" + fCheckpoint1.getTimestamp() + "]";
+ final String expected2 = "TmfCheckpoint [fLocation=" + fCheckpoint2.getLocation() +
+ ", fTimestamp=" + fCheckpoint2.getTimestamp() + "]";
+ final String expected3 = "TmfCheckpoint [fLocation=" + fCheckpoint3.getLocation() +
+ ", fTimestamp=" + fCheckpoint3.getTimestamp() + "]";
+
+ assertEquals("toString", expected1, fCheckpoint1.toString());
+ assertEquals("toString", expected2, fCheckpoint2.toString());
+ assertEquals("toString", expected3, fCheckpoint3.toString());
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Alexandre Montplaisir - Port to JUnit4
+ * Patrick Tasse - Updated for ranks in experiment location
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.indexer.checkpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.tests.TmfCoreTestPlugin;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfExperimentStub;
+import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfCheckpointIndexTest class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfExperimentCheckpointIndexTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final String DIRECTORY = "testfiles";
+ private static final String TEST_STREAM1 = "O-Test-10K";
+ private static final String TEST_STREAM2 = "E-Test-10K";
+ private static final String EXPERIMENT = "MyExperiment";
+ private static int NB_EVENTS = 20000;
+ private static int BLOCK_SIZE = 1000;
+
+ private static ITmfTrace[] fTestTraces;
+ private static TmfExperimentStub fExperiment;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ @Before
+ public void setUp() {
+ setupTraces();
+ fExperiment = new TmfExperimentStub(EXPERIMENT, fTestTraces, BLOCK_SIZE);
+ fExperiment.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
+ }
+
+ @After
+ public void tearDown() {
+ fExperiment.dispose();
+ fExperiment = null;
+ for (ITmfTrace trace : fTestTraces) {
+ trace.dispose();
+ }
+ fTestTraces = null;
+ }
+
+ private static void setupTraces() {
+ final String path1 = DIRECTORY + File.separator + TEST_STREAM1;
+ final String path2 = DIRECTORY + File.separator + TEST_STREAM2;
+
+ fTestTraces = new ITmfTrace[2];
+ try {
+ URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path1), null);
+ File test = new File(FileLocator.toFileURL(location).toURI());
+ final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, true, null, null);
+ fTestTraces[0] = trace1;
+ location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path2), null);
+ test = new File(FileLocator.toFileURL(location).toURI());
+ final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, true, null, null);
+ fTestTraces[1] = trace2;
+ } catch (final TmfTraceException e) {
+ e.printStackTrace();
+ } catch (final URISyntaxException e) {
+ e.printStackTrace();
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Verify checkpoints
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testTmfTraceIndexing() {
+ assertEquals("getCacheSize", BLOCK_SIZE, fExperiment.getCacheSize());
+ assertEquals("getTraceSize", NB_EVENTS, fExperiment.getNbEvents());
+ assertEquals("getRange-start", 1, fExperiment.getTimeRange().getStartTime().getValue());
+ assertEquals("getRange-end", NB_EVENTS, fExperiment.getTimeRange().getEndTime().getValue());
+ assertEquals("getStartTime", 1, fExperiment.getStartTime().getValue());
+ assertEquals("getEndTime", NB_EVENTS, fExperiment.getEndTime().getValue());
+
+ List<ITmfCheckpoint> checkpoints = fExperiment.getIndexer().getCheckpoints();
+ int pageSize = fExperiment.getCacheSize();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+
+ // Validate that each checkpoint points to the right event
+ for (int i = 0; i < checkpoints.size(); i++) {
+ ITmfCheckpoint checkpoint = checkpoints.get(i);
+ ITmfLocation location = checkpoint.getLocation();
+ ITmfContext context = fExperiment.seekEvent(location);
+ ITmfEvent event = fExperiment.parseEvent(context);
+ assertTrue(context.getRank() == i * pageSize);
+ assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Streaming
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testGrowingIndex() {
+ ITmfTrace[] testTraces = new TmfTraceStub[2];
+ try {
+ URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM1), null);
+ File test = new File(FileLocator.toFileURL(location).toURI());
+ final TmfTraceStub trace1 = new TmfTraceStub(test.getPath(), 0, false, null, null);
+ testTraces[0] = trace1;
+ location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM2), null);
+ test = new File(FileLocator.toFileURL(location).toURI());
+ final TmfTraceStub trace2 = new TmfTraceStub(test.getPath(), 0, false, null, null);
+ testTraces[1] = trace2;
+ } catch (final TmfTraceException e) {
+ e.printStackTrace();
+ } catch (final URISyntaxException e) {
+ e.printStackTrace();
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ TmfExperimentStub experiment = new TmfExperimentStub(EXPERIMENT, testTraces, BLOCK_SIZE);
+ int pageSize = experiment.getCacheSize();
+
+ // Build the first half of the index
+ TmfTimeRange range = new TmfTimeRange(new TmfTimestamp(1, -3), new TmfTimestamp(NB_EVENTS / 2 - 1, -3));
+ experiment.getIndexer().buildIndex(0, range, true);
+
+ // Validate that each checkpoint points to the right event
+ List<ITmfCheckpoint> checkpoints = experiment.getIndexer().getCheckpoints();
+ assertTrue("Checkpoints exist", checkpoints != null);
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE / 2, checkpoints.size());
+
+ // Build the second half of the index
+ experiment.getIndexer().buildIndex(NB_EVENTS / 2, TmfTimeRange.ETERNITY, true);
+
+ // Validate that each checkpoint points to the right event
+ assertEquals("Checkpoints size", NB_EVENTS / BLOCK_SIZE, checkpoints.size());
+ for (int i = 0; i < checkpoints.size(); i++) {
+ ITmfCheckpoint checkpoint = checkpoints.get(i);
+ ITmfLocation location = checkpoint.getLocation();
+ ITmfContext context = experiment.seekEvent(location);
+ ITmfEvent event = experiment.parseEvent(context);
+ assertTrue(context.getRank() == i * pageSize);
+ assertTrue((checkpoint.getTimestamp().compareTo(event.getTimestamp(), false) == 0));
+ assertEquals("Checkpoint value", i * pageSize + 1, checkpoint.getTimestamp().getValue());
+ }
+
+ /* Clean up (since we didn't use the class-specific fixtures) */
+ experiment.dispose();
+ for (ITmfTrace trace : testTraces) {
+ trace.dispose();
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Adjusted for new Trace Model
+ * Alexandre Montplaisir - Port to JUnit4
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.location;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.tmf.core.trace.location
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TmfLocationTest.class,
+})
+public class AllTests {}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Alexandre Montplaisir - Port to JUnit4
+ * Patrick Tasse - Add tests for TmfExperimentLocation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.location;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfExperimentLocation;
+import org.eclipse.linuxtools.internal.tmf.core.trace.TmfLocationArray;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfTimestampLocation;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test suite for the TmfLocation class.
+ */
+@SuppressWarnings("javadoc")
+public class TmfLocationTest {
+
+ // ------------------------------------------------------------------------
+ // Variables
+ // ------------------------------------------------------------------------
+
+ private String aString = "some location";
+ private Long aLong = 12345L;
+ private TmfTimestamp aTimestamp = new TmfTimestamp();
+ private TmfLocationArray aLocationArray;
+
+ private TmfStringLocation fLocation1;
+ private TmfStringLocation fLocation2;
+ private TmfLongLocation fLocation3;
+ private TmfTimestampLocation fLocation4;
+ private TmfExperimentLocation fExpLocation;
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ @Before
+ public void setUp() {
+ fLocation1 = new TmfStringLocation((String) null);
+ fLocation2 = new TmfStringLocation(aString);
+ fLocation3 = new TmfLongLocation(aLong);
+ fLocation4 = new TmfTimestampLocation(aTimestamp);
+ aLocationArray = new TmfLocationArray(
+ new ITmfLocation[] { fLocation1, fLocation2, fLocation3, fLocation4 },
+ new long[] { 1, 2, 3, 4 }
+ );
+ fExpLocation = new TmfExperimentLocation(aLocationArray);
+ }
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testTmfLocation() {
+ assertNull("TmfLocation", fLocation1.getLocationInfo());
+ assertEquals("TmfLocation", aString, fLocation2.getLocationInfo());
+ assertEquals("TmfLocation", aLong, fLocation3.getLocationInfo());
+ assertEquals("TmfLocation", aTimestamp, fLocation4.getLocationInfo());
+ assertEquals("TmfLocation", aLocationArray, fExpLocation.getLocationInfo());
+ }
+
+ @Test
+ public void testTmfLocationCopy() {
+ TmfStringLocation location1 = new TmfStringLocation(fLocation1);
+ TmfStringLocation location2 = new TmfStringLocation(fLocation2);
+ TmfLongLocation location3 = new TmfLongLocation(fLocation3);
+ TmfTimestampLocation location4 = new TmfTimestampLocation(fLocation4);
+ TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+
+ assertNull("TmfLocation", location1.getLocationInfo());
+ assertEquals("TmfLocation", aString, location2.getLocationInfo());
+ assertEquals("TmfLocation", aLong, location3.getLocationInfo());
+ assertEquals("TmfLocation", aTimestamp, location4.getLocationInfo());
+ assertEquals("TmfLocation", aLocationArray, expLocation.getLocationInfo());
+ }
+
+ // ------------------------------------------------------------------------
+ // hashCode
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testHashCode() {
+ TmfStringLocation location1 = new TmfStringLocation((String) null);
+ TmfStringLocation location2 = new TmfStringLocation(aString);
+ TmfLongLocation location3 = new TmfLongLocation(aLong);
+ TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+ TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
+ TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
+ TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
+ TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
+ TmfLocationArray locationArray3 = new TmfLocationArray(
+ new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
+ new long[] { 1, 2, 3 }
+ );
+ TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
+
+ assertTrue("hashCode", fLocation1.hashCode() == location1.hashCode());
+ assertTrue("hashCode", fLocation2.hashCode() == location2.hashCode());
+ assertTrue("hashCode", fLocation3.hashCode() == location3.hashCode());
+ assertTrue("hashCode", fExpLocation.hashCode() == expLocation.hashCode());
+
+ assertTrue("hashCode", fLocation2.hashCode() != location3.hashCode());
+ assertTrue("hashCode", fLocation3.hashCode() != location2.hashCode());
+ assertTrue("hashCode", fExpLocation.hashCode() != expLocation1.hashCode());
+ assertTrue("hashCode", fExpLocation.hashCode() != expLocation2.hashCode());
+ assertTrue("hashCode", fExpLocation.hashCode() != expLocation3.hashCode());
+ }
+
+ // ------------------------------------------------------------------------
+ // toEquals
+ // ------------------------------------------------------------------------
+
+ private static class TmfLocation2 extends TmfStringLocation {
+ public TmfLocation2(String location) {
+ super(location);
+ }
+ }
+
+ @Test
+ public void testEqualsWrongTypes() {
+ ITmfLocation location1 = new TmfStringLocation(aString);
+ TmfLocation2 location2 = new TmfLocation2(aString);
+
+ assertFalse("equals", location1.equals(location2));
+ assertFalse("equals", location2.equals(location1));
+ }
+
+ @Test
+ public void testEqualsWithNulls() {
+ TmfStringLocation location1 = new TmfStringLocation(aString);
+ TmfStringLocation location2 = new TmfStringLocation((String) null);
+
+ assertFalse("equals", location1.equals(location2));
+ assertFalse("equals", location2.equals(location1));
+ }
+
+ @Test
+ public void testEqualsReflexivity() {
+ assertTrue("equals", fLocation2.equals(fLocation2));
+ assertTrue("equals", fLocation3.equals(fLocation3));
+ assertTrue("equals", fExpLocation.equals(fExpLocation));
+
+ assertTrue("equals", !fLocation2.equals(fLocation3));
+ assertTrue("equals", !fLocation3.equals(fLocation2));
+ TmfLocationArray locationArray1 = new TmfLocationArray(aLocationArray, 3, fLocation4, 5);
+ TmfExperimentLocation expLocation1 = new TmfExperimentLocation(locationArray1);
+ TmfLocationArray locationArray2 = new TmfLocationArray(aLocationArray, 3, fLocation3, 4);
+ TmfExperimentLocation expLocation2 = new TmfExperimentLocation(locationArray2);
+ TmfLocationArray locationArray3 = new TmfLocationArray(
+ new ITmfLocation[] { fLocation1, fLocation2, fLocation3 },
+ new long[] { 1, 2, 3 }
+ );
+ TmfExperimentLocation expLocation3 = new TmfExperimentLocation(locationArray3);
+ assertTrue("equals", !fExpLocation.equals(expLocation1));
+ assertTrue("equals", !expLocation1.equals(fExpLocation));
+ assertTrue("equals", !fExpLocation.equals(expLocation2));
+ assertTrue("equals", !expLocation2.equals(fExpLocation));
+ assertTrue("equals", !fExpLocation.equals(expLocation3));
+ assertTrue("equals", !expLocation3.equals(fExpLocation));
+ }
+
+ @Test
+ public void testEqualsSymmetry() {
+ TmfStringLocation location2 = new TmfStringLocation(aString);
+ TmfLongLocation location3 = new TmfLongLocation(aLong);
+ TmfExperimentLocation expLocation = new TmfExperimentLocation(fExpLocation);
+
+ assertTrue("equals", location2.equals(fLocation2));
+ assertTrue("equals", fLocation2.equals(location2));
+
+ assertTrue("equals", location3.equals(fLocation3));
+ assertTrue("equals", fLocation3.equals(location3));
+
+ assertTrue("equals", expLocation.equals(fExpLocation));
+ assertTrue("equals", fExpLocation.equals(expLocation));
+ }
+
+ @Test
+ public void testEqualsTransivity() {
+ TmfStringLocation location1 = new TmfStringLocation(aString);
+ TmfStringLocation location2 = new TmfStringLocation(aString);
+ TmfStringLocation location3 = new TmfStringLocation(aString);
+ TmfExperimentLocation expLocation1 = new TmfExperimentLocation(aLocationArray);
+ TmfExperimentLocation expLocation2 = new TmfExperimentLocation(aLocationArray);
+ TmfExperimentLocation expLocation3 = new TmfExperimentLocation(aLocationArray);
+
+ assertTrue("equals", location1.equals(location2));
+ assertTrue("equals", location2.equals(location3));
+ assertTrue("equals", location3.equals(location1));
+ assertTrue("equals", expLocation1.equals(expLocation2));
+ assertTrue("equals", expLocation2.equals(expLocation3));
+ assertTrue("equals", expLocation3.equals(expLocation1));
+ }
+
+ @Test
+ public void testEqualsNull() {
+ assertTrue("equals", !fLocation2.equals(null));
+ assertTrue("equals", !fLocation2.equals(null));
+ assertTrue("equals", !fExpLocation.equals(null));
+ }
+
+ // ------------------------------------------------------------------------
+ // toString
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testToString() {
+ String str = "some location";
+ Long lng = 12345L;
+ TmfTimestamp ts = new TmfTimestamp();
+
+ TmfStringLocation location1 = new TmfStringLocation(str);
+ TmfLongLocation location2 = new TmfLongLocation(lng);
+ TmfTimestampLocation location3 = new TmfTimestampLocation(ts);
+ TmfExperimentLocation expLocation = new TmfExperimentLocation(aLocationArray);
+
+ String expected1 = "TmfStringLocation [fLocationInfo=" + str + "]";
+ String expected2 = "TmfLongLocation [fLocationInfo=" + lng + "]";
+ String expected3 = "TmfTimestampLocation [fLocationInfo=" + ts + "]";
+ String expected4 = "TmfExperimentLocation [" + aLocationArray + "]";
+
+ assertEquals("toString", expected1, location1.toString());
+ assertEquals("toString", expected2, location2.toString());
+ assertEquals("toString", expected3, location3.toString());
+ assertEquals("toString", expected4, expLocation.toString());
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.tests.trace.location;
+
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
+
+/**
+ * <b><u>TmfStringLocation</u></b>
+ * <p>
+ * Implement me. Please.
+ * <p>
+ */
+public class TmfStringLocation extends TmfLocation {
+
+ /**
+ * @param location the concrete trace location
+ */
+ public TmfStringLocation(String location) {
+ super(location);
+ }
+
+ /**
+ * @param other the other location
+ */
+ public TmfStringLocation(TmfStringLocation other) {
+ super(other.getLocationInfo());
+ }
+
+ @Override
+ public String getLocationInfo() {
+ return (String) super.getLocationInfo();
+ }
+
+}
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
try {
final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.getPath(), 0, true);
+ fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null);
} catch (final TmfTraceException e) {
e.printStackTrace();
} catch (final URISyntaxException e) {
final URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(path), null);
try {
final File test = new File(FileLocator.toFileURL(location).toURI());
- fTrace = new TmfTraceStub(test.getPath(), 0, true);
+ fTrace = new TmfTraceStub(test.getPath(), 0, true, null, null);
} catch (final TmfTraceException e) {
e.printStackTrace();
} catch (final URISyntaxException e) {
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
@SuppressWarnings("javadoc")
public class TmfSyntheticEventProviderStub extends TmfEventProvider {
- public static final int BLOCK_SIZE = 100;
public static final int NB_EVENTS = 1000;
public TmfSyntheticEventProviderStub() {
final TmfEventRequest eventRequest = (TmfEventRequest) request;
final TmfTimeRange range = eventRequest.getRange();
final TmfEventRequest subRequest =
- new TmfEventRequest(ITmfEvent.class, range, NB_EVENTS, BLOCK_SIZE) {
+ new TmfEventRequest(ITmfEvent.class, range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
* @param dataType the request data type
*/
public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType) {
- super(dataType);
+ super(dataType, 0, ALL_DATA, ExecutionType.FOREGROUND);
}
/**
* @param index the initial event index
*/
public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index) {
- super(dataType, index);
+ super(dataType, index, ALL_DATA, ExecutionType.FOREGROUND);
}
/**
* @param index the initial event index
* @param nbRequested the number of events requested
*/
- public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index, final int nbRequested) {
- super(dataType, index, nbRequested);
- }
-
- /**
- * @param dataType the request data type
- * @param index the initial event index
- * @param nbRequested the number of events requested
- * @param blockSize the event block size
- */
- public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType, final int index, final int nbRequested, final int blockSize) {
- super(dataType, index, nbRequested, blockSize);
+ public TmfDataRequestStub(final Class<? extends ITmfEvent> dataType,
+ final int index, final int nbRequested) {
+ super(dataType, index, nbRequested, ExecutionType.FOREGROUND);
}
@Override
* @param dataType the event type
*/
public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType) {
- super(dataType);
+ super(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, ExecutionType.FOREGROUND);
}
/**
* @param range the requested time range
*/
public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range) {
- super(dataType, range);
+ super(dataType, range, 0, ALL_DATA, ExecutionType.FOREGROUND);
}
/**
* @param nbRequested the number of events requested
*/
public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final int nbRequested) {
- super(dataType, range, nbRequested);
+ super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
}
/**
* @param blockSize the event block size
*/
public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final int nbRequested, final int blockSize) {
- super(dataType, range, nbRequested, blockSize);
+ super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
}
/**
* @param blockSize the event block size
*/
public TmfEventRequestStub(final Class<? extends ITmfEvent> dataType, final TmfTimeRange range, final long index, final int nbRequested, final int blockSize) {
- super(dataType, range, index, nbRequested, blockSize);
+ super(dataType, range, index, nbRequested, ExecutionType.FOREGROUND);
}
@Override
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* <b><u>TmfEmptyTraceStub</u></b>
import java.util.List;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfCheckpoint;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
/**
* <b><u>TmfIndexerStub</u></b>
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
/**
* <b><u>TmfTraceStub</u></b>
* <p>
* Dummy test trace. Use in conjunction with TmfEventParserStub.
*/
-@SuppressWarnings("javadoc")
public class TmfTraceStub extends TmfTrace implements ITmfEventParser {
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
public TmfTraceStub() {
super();
setParser(new TmfEventParserStub(this));
}
/**
+ * Constructor with which you can specify a custom streaming interval. The
+ * parser and indexer won't be specified.
+ *
* @param path
- * @throws FileNotFoundException
- */
- public TmfTraceStub(final String path) throws TmfTraceException {
- this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false);
- }
-
- /**
- * @param path
+ * The path to the trace file
* @param cacheSize
- * @throws FileNotFoundException
+ * The cache size
+ * @param interval
+ * The trace streaming interval
+ * @throws TmfTraceException
+ * If an error occurred opening the trace
*/
- public TmfTraceStub(final String path, final int cacheSize) throws TmfTraceException {
- this(path, cacheSize, false);
- }
-
- /**
- * @param path
- * @param cacheSize
- * @throws FileNotFoundException
- */
- public TmfTraceStub(final String path, final int cacheSize, final long interval) throws TmfTraceException {
+ public TmfTraceStub(final String path,
+ final int cacheSize,
+ final long interval) throws TmfTraceException {
super(null, ITmfEvent.class, path, cacheSize, interval, null, null);
- try {
- fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
- } catch (FileNotFoundException e) {
- throw new TmfTraceException(e.getMessage());
- }
+ setupTrace(path);
setParser(new TmfEventParserStub(this));
}
/**
+ * Constructor to specify the parser and indexer. The streaming interval
+ * will be 0.
+ *
* @param path
+ * The path to the trace file
* @param cacheSize
- * @throws FileNotFoundException
- */
- public TmfTraceStub(final String path, final int cacheSize, final ITmfTraceIndexer indexer) throws TmfTraceException {
- this(path, cacheSize, false, null, indexer);
- }
-
- /**
- * @param path
- * @param waitForCompletion
- * @throws FileNotFoundException
- */
- public TmfTraceStub(final String path, final boolean waitForCompletion) throws TmfTraceException {
- this(path, ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, waitForCompletion);
- }
-
- /**
- * @param path
- * @param cacheSize
+ * The cache size
* @param waitForCompletion
- * @throws FileNotFoundException
+ * Do we block the caller until the trace is indexed, or not.
+ * @param indexer
+ * The trace indexer to use
+ * @param parser
+ * The trace parser. If left 'null', it will use a
+ * {@link TmfEventParserStub}.
+ * @throws TmfTraceException
+ * If an error occurred opening the trace
*/
- public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
- super(null, ITmfEvent.class, path, cacheSize, 0, null, null);
- try {
- fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
- } catch (FileNotFoundException e) {
- throw new TmfTraceException(e.getMessage());
- }
- setParser(new TmfEventParserStub(this));
+ public TmfTraceStub(final String path,
+ final int cacheSize,
+ final boolean waitForCompletion,
+ final ITmfTraceIndexer indexer,
+ final ITmfEventParser parser) throws TmfTraceException {
+ super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null);
+ setupTrace(path);
+ setParser((parser != null) ? parser : new TmfEventParserStub(this));
if (waitForCompletion) {
indexTrace(true);
}
}
/**
- * @param path
- * @param cacheSize
- * @param waitForCompletion
- * @throws FileNotFoundException
+ * Copy constructor
+ *
+ * @param trace
+ * The trace to copy
+ * @throws TmfTraceException
+ * If an error occurred opening the trace
*/
- public TmfTraceStub(final IResource resource, final String path, final int cacheSize, final boolean waitForCompletion) throws TmfTraceException {
- super(resource, ITmfEvent.class, path, cacheSize, 0, null, null);
- try {
- fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
- } catch (FileNotFoundException e) {
- throw new TmfTraceException(e.getMessage());
- }
+ public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException {
+ super(trace);
+ setupTrace(getPath()); // fPath will be set by the super-constructor
setParser(new TmfEventParserStub(this));
}
- /**
- * @param path
- * @param cacheSize
- * @param waitForCompletion
- * @param parser
- * @throws FileNotFoundException
- */
- public TmfTraceStub(final String path, final int cacheSize, final boolean waitForCompletion,
- final ITmfEventParser parser, final ITmfTraceIndexer indexer) throws TmfTraceException {
- super(null, ITmfEvent.class, path, cacheSize, 0, indexer, null);
+
+ private void setupTrace(String path) throws TmfTraceException {
try {
fTrace = new RandomAccessFile(path, "r"); //$NON-NLS-1$
} catch (FileNotFoundException e) {
throw new TmfTraceException(e.getMessage());
}
- setParser((parser != null) ? parser : new TmfEventParserStub(this));
}
- /**
- * Copy constructor
- */
- public TmfTraceStub(final TmfTraceStub trace) throws TmfTraceException {
- super(trace);
- try {
- fTrace = new RandomAccessFile(getPath(), "r"); //$NON-NLS-1$
- } catch (FileNotFoundException e) {
- throw new TmfTraceException(e.getMessage());
- }
- setParser(new TmfEventParserStub(this));
- }
+ // ------------------------------------------------------------------------
+ // Initializers
+ // ------------------------------------------------------------------------
@Override
public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> type) throws TmfTraceException {
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * @return The file stream to the trace
+ */
public RandomAccessFile getStream() {
return fTrace;
}
+ /**
+ * Set the initial range offset.
+ *
+ * @param initOffset
+ * The new initial range offset
+ */
public void setInitialRangeOffset(ITmfTimestamp initOffset) {
fInitialRangeOffset = initOffset;
}
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.tmf.core;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.tmf.core.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.ctf.core;bundle-version="2.1.0"
+ org.eclipse.linuxtools.ctf.core;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.internal.tmf.core;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
org.eclipse.linuxtools.internal.tmf.core.component;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
org.eclipse.linuxtools.internal.tmf.core.request;x-friends:="org.eclipse.linuxtools.tmf.core.tests",
org.eclipse.linuxtools.tmf.core.statistics,
org.eclipse.linuxtools.tmf.core.timestamp,
org.eclipse.linuxtools.tmf.core.trace,
+ org.eclipse.linuxtools.tmf.core.trace.indexer,
+ org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint,
+ org.eclipse.linuxtools.tmf.core.trace.location,
org.eclipse.linuxtools.tmf.core.uml2sd,
org.eclipse.linuxtools.tmf.core.util
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf.core</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools TMF Core Plug-in</name>
super.stop(context);
}
+
+ // ------------------------------------------------------------------------
+ // Log an IStatus
+ // ------------------------------------------------------------------------
+
+ /**
+ * Log an IStatus object directly
+ *
+ * @param status
+ * The status to log
+ */
+ public static void log(IStatus status) {
+ fPlugin.getLog().log(status);
+ }
+
// ------------------------------------------------------------------------
// Log INFO
// ------------------------------------------------------------------------
public static void logError(String message, Throwable exception) {
fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
}
-
}
package org.eclipse.linuxtools.internal.tmf.core.request;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
// Attributes
// ------------------------------------------------------------------------
- /**
- * The list of coalesced requests
- */
- protected Vector<ITmfDataRequest> fRequests = new Vector<ITmfDataRequest>();
+ /**
+ * The list of coalesced requests
+ */
+ protected final List<ITmfDataRequest> fRequests = new ArrayList<ITmfDataRequest>();
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
- /**
- * Request all the events of a given type (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param priority the requested execution priority
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request all the events of a given type from the given index (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type from the given index (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param priority the requested execution priority
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, ExecutionType priority) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given index (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type from the given index (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param priority the requested execution priority
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given index (high priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- */
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize) {
- super(ITmfEvent.class, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
- }
-
/**
* Request 'n' events of a given type from the given index (given priority).
* Events are returned in blocks of the given size.
*
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
+ * @param dataType
+ * The requested data type
+ * @param index
+ * The index of the first event to retrieve. Use '0' to start at
+ * the beginning.
+ * @param nbRequested
+ * The number of events requested. You can use
+ * {@link TmfDataRequest#ALL_DATA} to request all events.
+ * @param priority
+ * The requested execution priority
*/
- public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize, ExecutionType priority) {
- super(ITmfEvent.class, index, nbRequested, blockSize, priority);
+ public TmfCoalescedDataRequest(Class<? extends ITmfEvent> dataType,
+ long index,
+ int nbRequested,
+ ExecutionType priority) {
+ super(ITmfEvent.class, index, nbRequested, priority);
}
// ------------------------------------------------------------------------
/**
* Add a request to this one.
*
- * @param request The request to add
+ * @param request
+ * The request to add
*/
public void addRequest(ITmfDataRequest request) {
fRequests.add(request);
fIndex = start;
}
if ((request.getNbRequested() == TmfDataRequest.ALL_DATA) ||
- (fNbRequested == TmfDataRequest.ALL_DATA))
+ (fNbRequested == TmfDataRequest.ALL_DATA))
{
fNbRequested = TmfDataRequest.ALL_DATA;
} else {
}
}
- /**
- * @return The list of IDs of the sub-requests
- */
- @SuppressWarnings("nls")
+ /**
+ * @return The list of IDs of the sub-requests
+ */
+ @SuppressWarnings("nls")
public String getSubRequestIds() {
- StringBuffer result = new StringBuffer("[");
- for (int i = 0; i < fRequests.size(); i++) {
- if (i != 0) {
+ StringBuffer result = new StringBuffer("[");
+ for (int i = 0; i < fRequests.size(); i++) {
+ if (i != 0) {
result.append(", ");
}
- result.append(fRequests.get(i).getRequestId());
- }
- result.append("]");
- return result.toString();
- }
+ result.append(fRequests.get(i).getRequestId());
+ }
+ result.append("]");
+ return result.toString();
+ }
// ------------------------------------------------------------------------
// ITmfDataRequest
// ------------------------------------------------------------------------
@Override
- public void handleData(ITmfEvent data) {
- super.handleData(data);
- // Don't call sub-requests handleData() unless this is a
- // TmfCoalescedDataRequest; extended classes should call
- // the sub-requests handleData().
- if (getClass() == TmfCoalescedDataRequest.class) {
- long index = getIndex() + getNbRead() - 1;
- for (ITmfDataRequest request : fRequests) {
- if (!request.isCompleted()) {
+ public void handleData(ITmfEvent data) {
+ super.handleData(data);
+ // Don't call sub-requests handleData() unless this is a
+ // TmfCoalescedDataRequest; extended classes should call
+ // the sub-requests handleData().
+ if (getClass() == TmfCoalescedDataRequest.class) {
+ long index = getIndex() + getNbRead() - 1;
+ for (ITmfDataRequest request : fRequests) {
+ if (!request.isCompleted()) {
if (request.getDataType().isInstance(data)) {
long start = request.getIndex();
long end = start + request.getNbRequested();
super.start();
}
- @Override
+ @Override
public void done() {
- for (ITmfDataRequest request : fRequests) {
- if (!request.isCompleted()) {
- request.done();
- }
- }
- super.done();
+ for (ITmfDataRequest request : fRequests) {
+ if (!request.isCompleted()) {
+ request.done();
+ }
+ }
+ super.done();
}
@Override
public void fail() {
- for (ITmfDataRequest request : fRequests) {
- request.fail();
- }
- super.fail();
+ for (ITmfDataRequest request : fRequests) {
+ request.fail();
+ }
+ super.fail();
}
@Override
public void cancel() {
- for (ITmfDataRequest request : fRequests) {
- if (!request.isCompleted()) {
- request.cancel();
- }
- }
- super.cancel();
+ for (ITmfDataRequest request : fRequests) {
+ if (!request.isCompleted()) {
+ request.cancel();
+ }
+ }
+ super.cancel();
}
@Override
}
-
// ------------------------------------------------------------------------
// Object
// ------------------------------------------------------------------------
@Override
// All requests have a unique id
public int hashCode() {
- return super.hashCode();
+ return super.hashCode();
}
@Override
public boolean equals(Object other) {
- if (other instanceof TmfCoalescedDataRequest) {
- TmfCoalescedDataRequest request = (TmfCoalescedDataRequest) other;
- return (request.getDataType() == getDataType()) &&
- (request.getIndex() == getIndex()) &&
- (request.getNbRequested() == getNbRequested() &&
- (request.getExecType() == getExecType()));
- }
- return false;
+ if (other instanceof TmfCoalescedDataRequest) {
+ TmfCoalescedDataRequest request = (TmfCoalescedDataRequest) other;
+ return (request.getDataType() == getDataType()) &&
+ (request.getIndex() == getIndex()) &&
+ (request.getNbRequested() == getNbRequested() &&
+ (request.getExecType() == getExecType()));
+ }
+ return false;
}
@Override
@SuppressWarnings("nls")
public String toString() {
return "[TmfCoalescedDataRequest(" + getRequestId() + "," + getDataType().getSimpleName()
- + "," + getExecType() + "," + getIndex() + "," + getNbRequested() + ","
- + getBlockSize() + ", " + fRequests.toString() + ")]";
+ + "," + getExecType() + "," + getIndex() + "," + getNbRequested() + ", "
+ + fRequests.toString() + ")]";
}
}
// Attributes
// ------------------------------------------------------------------------
- private TmfTimeRange fRange; // The requested events time range
+ private TmfTimeRange fRange; // The requested events time range
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
/**
- * Request all the events of a given type (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
+ * Request 'n' events of a given type for the given time range (given
+ * priority). Events are returned in blocks of the given size.
*
- * @param dataType the requested data type
+ * @param dataType
+ * The requested data type
+ * @param range
+ * The range of the request. You can use
+ * {@link TmfTimeRange#ETERNITY} to request all events.
+ * @param index
+ * The index of the first event to retrieve. Use '0' to start at
+ * the beginning.
+ * @param nbRequested
+ * The number of events requested. You can use
+ * {@link TmfDataRequest#ALL_DATA} to request all events.
+ * @param priority
+ * The requested execution priority
*/
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType) {
- this(dataType, TmfTimeRange.ETERNITY, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param priority the requested execution priority
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
- this(dataType, TmfTimeRange.ETERNITY, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request all the events of a given type for the given time range (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range) {
- this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type for the given time range (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param priority the requested execution priority
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, ExecutionType priority) {
- this(dataType, range, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given time range (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested) {
- this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param priority the requested execution priority
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, ExecutionType priority) {
- this(dataType, range, nbRequested, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (high priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
- this(dataType, range, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize, ExecutionType priority) {
- this(dataType, range, 0, nbRequested, blockSize, priority);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
- */
- public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize, ExecutionType priority) {
- super(ITmfEvent.class, index, nbRequested, blockSize, priority);
+ public TmfCoalescedEventRequest(Class<? extends ITmfEvent> dataType,
+ TmfTimeRange range,
+ long index,
+ int nbRequested,
+ ExecutionType priority) {
+ super(ITmfEvent.class, index, nbRequested, priority);
fRange = range;
if (TmfCoreTracer.isRequestTraced()) {
}
}
- @Override
- public boolean isCompatible(ITmfDataRequest request) {
- if (request instanceof ITmfEventRequest) {
- if (super.isCompatible(request)) {
- return overlaps((ITmfEventRequest) request);
- }
- }
- return false;
- }
+ @Override
+ public boolean isCompatible(ITmfDataRequest request) {
+ if (request instanceof ITmfEventRequest) {
+ if (super.isCompatible(request)) {
+ return overlaps((ITmfEventRequest) request);
+ }
+ }
+ return false;
+ }
private boolean overlaps(ITmfEventRequest request) {
ITmfTimestamp startTime = request.getRange().getStartTime();
- ITmfTimestamp endTime = request.getRange().getEndTime();
+ ITmfTimestamp endTime = request.getRange().getEndTime();
return (startTime.compareTo(endTime) <= 0) && (fRange.getStartTime().compareTo(fRange.getEndTime()) <= 0);
}
private void merge(ITmfEventRequest request) {
ITmfTimestamp startTime = request.getRange().getStartTime();
- ITmfTimestamp endTime = request.getRange().getEndTime();
+ ITmfTimestamp endTime = request.getRange().getEndTime();
if (!fRange.contains(startTime) && fRange.getStartTime().compareTo(startTime) > 0) {
fRange = new TmfTimeRange(startTime, fRange.getEndTime());
}
// ITmfEventRequest
// ------------------------------------------------------------------------
- @Override
- public TmfTimeRange getRange() {
- return fRange;
- }
+ @Override
+ public TmfTimeRange getRange() {
+ return fRange;
+ }
- @Override
- public void setStartIndex(int index) {
- setIndex(index);
- }
+ @Override
+ public void setStartIndex(int index) {
+ setIndex(index);
+ }
// ------------------------------------------------------------------------
// Object
@Override
// All requests have a unique id
public int hashCode() {
- return super.hashCode();
+ return super.hashCode();
}
@Override
public boolean equals(Object other) {
- if (other instanceof TmfCoalescedEventRequest) {
- TmfCoalescedEventRequest request = (TmfCoalescedEventRequest) other;
- return (request.getDataType() == getDataType()) &&
- (request.getIndex() == getIndex()) &&
- (request.getNbRequested() == getNbRequested()) &&
- (request.getRange().equals(getRange()));
- }
- if (other instanceof TmfCoalescedDataRequest) {
- return super.equals(other);
- }
- return false;
+ if (other instanceof TmfCoalescedEventRequest) {
+ TmfCoalescedEventRequest request = (TmfCoalescedEventRequest) other;
+ return (request.getDataType() == getDataType()) &&
+ (request.getIndex() == getIndex()) &&
+ (request.getNbRequested() == getNbRequested()) &&
+ (request.getRange().equals(getRange()));
+ }
+ if (other instanceof TmfCoalescedDataRequest) {
+ return super.equals(other);
+ }
+ return false;
}
@Override
public String toString() {
return "[TmfCoalescedEventRequest(" + getRequestId() + "," + getDataType().getSimpleName()
+ "," + getExecType() + "," + getRange() + "," + getIndex() + "," + getNbRequested()
- + "," + getBlockSize() + ", " + fRequests.toString() + ")]";
+ + ", " + fRequests.toString() + ")]";
}
}
}
class StateSystemBuildRequest extends TmfEventRequest {
-
- /** The amount of events queried at a time through the requests */
- private static final int CHUNK_SIZE = 50000;
-
private final HistoryBuilder builder;
private final ITmfStateProvider sci;
private final ITmfTrace trace;
StateSystemBuildRequest(HistoryBuilder builder) {
super(builder.getStateProvider().getExpectedEventType(),
TmfTimeRange.ETERNITY,
+ 0,
TmfDataRequest.ALL_DATA,
- CHUNK_SIZE,
ITmfDataRequest.ExecutionType.BACKGROUND);
this.builder = builder;
this.sci = builder.getStateProvider();
// ------------------------------------------------------------------------
private class CheckpointsRequest extends TmfEventRequest {
-
- /** The amount of events queried at a time through the requests */
- private static final int CHUNK_SIZE = 50000;
-
private final ITmfTrace trace;
private final Map<Long, Long> checkpts;
private long eventCount;
public CheckpointsRequest(ITmfStateProvider input, Map<Long, Long> checkpoints) {
super(input.getExpectedEventType(),
TmfTimeRange.ETERNITY,
+ 0,
TmfDataRequest.ALL_DATA,
- CHUNK_SIZE,
ITmfDataRequest.ExecutionType.BACKGROUND);
checkpoints.clear();
this.trace = input.getTrace();
}
private class PartialStateSystemRequest extends TmfEventRequest {
-
- private static final int CHUNK_SIZE = 50000;
private final ITmfStateProvider sci;
private final ITmfTrace trace;
PartialStateSystemRequest(ITmfStateProvider sci, TmfTimeRange range) {
super(sci.getExpectedEventType(),
range,
+ 0,
TmfDataRequest.ALL_DATA,
- CHUNK_SIZE,
ITmfDataRequest.ExecutionType.BACKGROUND);
this.sci = sci;
this.trace = sci.getTrace();
package org.eclipse.linuxtools.internal.tmf.core.trace;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
import java.util.Arrays;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
protected void newCoalescedDataRequest(ITmfDataRequest request) {
synchronized (fLock) {
TmfCoalescedDataRequest coalescedRequest = new TmfCoalescedDataRequest(request.getDataType(), request.getIndex(),
- request.getNbRequested(), request.getBlockSize(), request.getExecType());
+ request.getNbRequested(), request.getExecType());
coalescedRequest.addRequest(request);
if (TmfCoreTracer.isRequestTraced()) {
TmfCoreTracer.traceRequest(request, "COALESCED with " + coalescedRequest.getRequestId()); //$NON-NLS-1$
if (request.getExecType() == ExecutionType.FOREGROUND) {
queueRequest(request);
} else {
- queueBackgroundRequest(request, request.getBlockSize(), true);
+ queueBackgroundRequest(request, true);
}
}
*
* @param request
* The request
- * @param blockSize
- * The request should be split in chunks of this size
* @param indexing
* Should we index the chunks
+ * @since 3.0
*/
- protected void queueBackgroundRequest(final ITmfDataRequest request, final int blockSize, final boolean indexing) {
+ protected void queueBackgroundRequest(final ITmfDataRequest request, final boolean indexing) {
queueRequest(request);
}
protected synchronized void newCoalescedDataRequest(ITmfDataRequest request) {
if (request instanceof ITmfEventRequest) {
ITmfEventRequest eventRequest = (ITmfEventRequest) request;
- TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(eventRequest.getDataType(), eventRequest.getRange(),
- eventRequest.getIndex(), eventRequest.getNbRequested(), eventRequest.getBlockSize(), eventRequest.getExecType());
+ TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(
+ eventRequest.getDataType(),
+ eventRequest.getRange(),
+ eventRequest.getIndex(),
+ eventRequest.getNbRequested(),
+ eventRequest.getExecType());
coalescedRequest.addRequest(eventRequest);
if (TmfCoreTracer.isRequestTraced()) {
TmfCoreTracer.traceRequest(request, "COALESCED with " + coalescedRequest.getRequestId()); //$NON-NLS-1$
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The CTF trace reader iterator.
/**
* Method setLocation.
* @param location ITmfLocation<?>
+ * @since 3.0
*/
@Override
public void setLocation(final ITmfLocation location) {
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLocation;
/**
* The nugget of information that is unique to a location in a CTF trace.
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
return curRank;
}
+ /**
+ * @since 3.0
+ */
@Override
public ITmfLocation getLocation() {
return curLocation;
return curRank != CtfLocation.INVALID_LOCATION.getTimestamp();
}
+ /**
+ * @since 3.0
+ */
@Override
public void setLocation(ITmfLocation location) {
curLocation = (CtfLocation) location;
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public String toString() {
return getName() + '=' + getFormattedValue();
}
-
- /**
- * Print a numeric value as a string in a given base
- *
- * @param value
- * The value to print as string
- * @param base
- * The base for this value
- * @param signed
- * Is the value signed or not
- * @return formatted number string
- * @since 2.0
- */
- public final static String formatNumber(long value, int base, boolean signed) {
- String s;
-
- /* Format the number correctly according to the integer's base */
- switch (base) {
- case 2:
- s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
- break;
- case 8:
- s = "0" + Long.toOctalString(value); //$NON-NLS-1$
-
- break;
- case 16:
- s = "0x" + Long.toHexString(value); //$NON-NLS-1$
- break;
- case 10:
- default:
- /* For non-standard base, we'll just print it as a decimal number */
- if (!signed && value < 0) {
- /* Since there are no 'unsigned long', handle this case with BigInteger */
- BigInteger bigInteger = BigInteger.valueOf(value);
- /*
- * powerOfTwo = 2^64 we add 2^64 to the negative number to get
- * the real unsigned value
- */
- BigInteger powerOfTwo = (BigInteger.valueOf(Long.MAX_VALUE)).add(BigInteger.valueOf(1));
- powerOfTwo = powerOfTwo.multiply(BigInteger.valueOf(2));
- bigInteger = bigInteger.add(powerOfTwo);
-
- s = bigInteger.toString();
- } else {
- s = Long.toString(value);
- }
- break;
- }
- return s;
- }
-
}
/**
@Override
public String getFormattedValue() {
- return formatNumber(getValue(), base, signed);
+ return IntegerDefinition.formatNumber(getValue(), base, signed);
}
}
if (formattedValue == null) {
List<String> strings = new ArrayList<String>();
for (Long value : getValue()) {
- strings.add(formatNumber(value, base, signed));
+ strings.add(IntegerDefinition.formatNumber(value, base, signed));
}
formattedValue = strings.toString();
}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.ctf.core.event.IEventDeclaration;
+import org.eclipse.linuxtools.ctf.core.event.CTFClock;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The CTf trace handler
*/
protected static final int DEFAULT_CACHE_SIZE = 50000;
+ /*
+ * The Ctf clock unique identifier field
+ */
+ private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+
// -------------------------------------------
// Fields
// -------------------------------------------
*
* @return null, since the trace has no knowledge of the current location
* @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#getCurrentLocation()
+ * @since 3.0
*/
@Override
public ITmfLocation getCurrentLocation() {
return null;
}
+ /**
+ * @since 3.0
+ */
@Override
public double getLocationRatio(ITmfLocation location) {
final CtfLocation curLocation = (CtfLocation) location;
* @param location
* ITmfLocation<?>
* @return ITmfContext
+ * @since 3.0
*/
@Override
public synchronized ITmfContext seekEvent(final ITmfLocation location) {
return fTrace;
}
+ /**
+ * Ctf traces have a clock with a unique uuid that will be used to identify
+ * the host. Traces with the same clock uuid will be known to have been made
+ * on the same machine.
+ *
+ * Note: uuid is an optional field, it may not be there for a clock.
+ */
+ @Override
+ public String getHostId() {
+ CTFClock clock = getCTFTrace().getClock();
+ if (clock != null) {
+ String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
+ if (clockHost != null) {
+ return clockHost;
+ }
+ }
+ return super.getHostId();
+ }
+
// -------------------------------------------
// ITmfTraceProperties
// -------------------------------------------
* @param eventName
* The name of the event to check
* @return Whether the event is in the metadata or not
- * @since 2.1
+ * @since 3.0
*/
public boolean hasEvent(final String eventName) {
Map<Long, IEventDeclaration> events = fTrace.getEvents(0L);
* @param names
* The array of events to check for
* @return Whether all events are in the metadata
- * @since 2.1
+ * @since 3.0
*/
public boolean hasAllEvents(String[] names) {
for (String name : names) {
* @param names
* The array of event names of check for
* @return Whether one of the event is present in trace metadata
- * @since 2.1
+ * @since 3.0
*/
public boolean hasAtLeastOneOfEvents(String[] names) {
for (String name : names) {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.core.ctfadaptor.messages"; //$NON-NLS-1$
/** Buffer overflow detected
- * @since 2.1*/
+ * @since 3.0*/
public static String CtfTmfTrace_BufferOverflowErrorMessage;
/** Major version number not set */
*/
ITmfEventField getField(int index);
+ /**
+ * Gets the a sub-field of this field, which may be multiple levels down.
+ *
+ * @param path
+ * Array of field names to recursively go through
+ * @return The field at the end, or null if a field in the path cannot be
+ * found
+ * @since 3.0
+ */
+ ITmfEventField getSubField(String[] path);
+
}
return null;
}
+ /**
+ * @since 3.0
+ */
+ @Override
+ public ITmfEventField getSubField(final String[] names) {
+ ITmfEventField field = this;
+ for (String name : names) {
+ field = field.getField(name);
+ if (field == null) {
+ return null;
+ }
+ }
+ return field;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
*/
int getNbRequested();
- /**
- * @return the block size (for BG requests)
- */
- int getBlockSize();
-
/**
* @return the number of events read so far
*/
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Alexandre Montplaisir - Consolidated constructors
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.request;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
/**
- * TmfDataRequests are used to obtain blocks of contiguous data from a data provider. Open ranges can be used,
- * especially for continuous streaming.
+ * TmfDataRequests are used to obtain blocks of contiguous data from a data
+ * provider. Open ranges can be used, especially for continuous streaming.
* <p>
- * The request is processed asynchronously by a TmfProvider and, as blocks of data become available, handleData() is
- * invoked synchronously for each block. Upon return, the data instances go out of scope and become eligible for gc. It
- * is is thus the responsibility of the requester to either clone or keep a reference to the data it wishes to track
- * specifically.
+ * The request is processed asynchronously by a TmfProvider and, as blocks of
+ * data become available, handleData() is invoked synchronously for each block.
+ * Upon return, the data instances go out of scope and become eligible for gc.
+ * It is is thus the responsibility of the requester to either clone or keep a
+ * reference to the data it wishes to track specifically.
* <p>
- * This data block approach is used to avoid busting the heap for very large trace files. The block size is
- * configurable.
+ * This data block approach is used to avoid busting the heap for very large
+ * trace files. The block size is configurable.
* <p>
- * The TmfProvider indicates that the request is completed by calling done(). The request can be canceled at any time
- * with cancel().
+ * The TmfProvider indicates that the request is completed by calling done().
+ * The request can be canceled at any time with cancel().
* <p>
* Typical usage:
*
* </i></code>
* </pre>
*
- * TODO: Consider decoupling from "time range", "rank", etc and for the more generic notion of "criteria". This would
- * allow to extend for "time range", etc instead of providing specialized constructors. This also means removing the
- * criteria info from the data structure (with the possible exception of fNbRequested). The nice thing about it is that
- * it would prepare us well for the coming generation of analysis tools.
+ * TODO: Consider decoupling from "time range", "rank", etc and for the more
+ * generic notion of "criteria". This would allow to extend for "time range",
+ * etc instead of providing specialized constructors. This also means removing
+ * the criteria info from the data structure (with the possible exception of
+ * fNbRequested). The nice thing about it is that it would prepare us well for
+ * the coming generation of analysis tools.
*
* TODO: Implement request failures (codes, etc...)
*
// Constants
// ------------------------------------------------------------------------
- /** The default maximum number of events per chunk */
- public static final int DEFAULT_BLOCK_SIZE = 1000;
-
/** The request count for all the events */
public static final int ALL_DATA = Integer.MAX_VALUE;
/** The number of requested events (ALL_DATA for all) */
protected int fNbRequested;
- /** The block size (for BG requests) */
- private final int fBlockSize;
-
/** The number of reads so far */
private int fNbRead;
fRequestNumber = 0;
}
- /**
- * Request all the events of a given type (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param priority the requested execution priority
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
- this(dataType, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request all the events of a given type from the given index (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type from the given index (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param priority the requested execution priority
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, ExecutionType priority) {
- this(dataType, index, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given index (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type from the given index (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param priority the requested execution priority
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
- this(dataType, index, nbRequested, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given index (high priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- */
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize) {
- this(dataType, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
- }
-
/**
* Request 'n' events of a given type from the given index (given priority).
* Events are returned in blocks of the given size.
*
- * @param dataType the requested data type
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
+ * @param dataType
+ * The requested data type.
+ * @param index
+ * The index of the first event to retrieve. Use '0' to start at
+ * the beginning of the trace.
+ * @param nbRequested
+ * The number of events requested. You can use
+ * {@link TmfDataRequest#ALL_DATA} to specify you want all events
+ * in the trace.
+ * @param priority
+ * The requested execution priority.
*/
- public TmfDataRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, int blockSize, ExecutionType priority) {
+ public TmfDataRequest(Class<? extends ITmfEvent> dataType,
+ long index,
+ int nbRequested,
+ ExecutionType priority) {
fRequestId = fRequestNumber++;
fDataType = dataType;
fIndex = index;
fNbRequested = nbRequested;
- fBlockSize = blockSize;
fExecType = priority;
fNbRead = 0;
return fNbRequested;
}
- /**
- * @return the block size (for BG requests)
- */
- @Override
- public int getBlockSize() {
- return fBlockSize;
- }
-
/**
* @return the number of events read so far
*/
name = name.substring(dot + 1);
}
return "[" + name + "(" + fRequestId + "," + fDataType.getSimpleName()+ "," + getExecType()
- + "," + fIndex + "," + fNbRequested + "," + getBlockSize() + ")]";
+ + "," + fIndex + "," + fNbRequested + ")]";
}
}
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Alexandre Montplaisir - Consolidated constructors
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.request;
// Attributes
// ------------------------------------------------------------------------
- private final TmfTimeRange fRange; // The requested events time range
+ private final TmfTimeRange fRange; // The requested events time range
// ------------------------------------------------------------------------
- // Constructors
+ // Constructor
// ------------------------------------------------------------------------
/**
- * Request all the events of a given type (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
+ * Request 'n' events of a given type for the given time range (given
+ * priority). Events are returned in blocks of the given size.
*
- * @param dataType the requested data type
+ * @param dataType
+ * The requested data type.
+ * @param range
+ * The time range of the requested events. You can use
+ * {@link TmfTimeRange#ETERNITY} to indicate you want to cover
+ * the whole trace.
+ * @param index
+ * The index of the first event to retrieve. You can use '0' to
+ * start at the beginning of the trace.
+ * @param nbRequested
+ * The number of events requested. You can use
+ * {@link TmfEventRequest#ALL_DATA} to indicate you want all
+ * events in the time range.
+ * @param priority
+ * The requested execution priority.
+ * @since 3.0
*/
- public TmfEventRequest(Class<? extends ITmfEvent> dataType) {
- this(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param priority the requested execution priority
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, ExecutionType priority) {
- this(dataType, TmfTimeRange.ETERNITY, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request all the events of a given type for the given time range (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range) {
- this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request all the events of a given type for the given time range (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param priority the requested execution priority
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, ExecutionType priority) {
- this(dataType, range, 0, ALL_DATA, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type from the given time range (high priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested) {
- this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority)
- * Events are returned in blocks of the default size (DEFAULT_BLOCK_SIZE).
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param priority the requested execution priority
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, ExecutionType priority) {
- this(dataType, range, 0, nbRequested, DEFAULT_BLOCK_SIZE, priority);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (high priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize) {
- this(dataType, range, 0, nbRequested, blockSize, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (high priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize) {
- this(dataType, range, index, nbRequested, blockSize, ExecutionType.FOREGROUND);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, int nbRequested, int blockSize, ExecutionType priority) {
- this(dataType, range, 0, nbRequested, blockSize, priority);
- }
-
- /**
- * Request 'n' events of a given type for the given time range (given priority).
- * Events are returned in blocks of the given size.
- *
- * @param dataType the requested data type
- * @param range the time range of the requested events
- * @param index the index of the first event to retrieve
- * @param nbRequested the number of events requested
- * @param blockSize the number of events per block
- * @param priority the requested execution priority
- */
- public TmfEventRequest(Class<? extends ITmfEvent> dataType, TmfTimeRange range, long index, int nbRequested, int blockSize, ExecutionType priority) {
- super(dataType, index, nbRequested, blockSize, priority);
- fRange = range;
+ public TmfEventRequest(Class<? extends ITmfEvent> dataType,
+ TmfTimeRange range,
+ long index,
+ int nbRequested,
+ ExecutionType priority) {
+ super(dataType, index, nbRequested, priority);
+ fRange = range;
if (TmfCoreTracer.isRequestTraced()) {
String type = getClass().getName();
* @since 2.0
*/
@Override
- public TmfTimeRange getRange() {
+ public TmfTimeRange getRange() {
return fRange;
}
// ------------------------------------------------------------------------
/**
- * this method is called by the event provider to set the index corresponding
- * to the time range start time once it is known
+ * this method is called by the event provider to set the index
+ * corresponding to the time range start time once it is known
*
- * @param index the start index
+ * @param index
+ * the start index
*/
@Override
- public void setStartIndex(int index) {
- setIndex(index);
+ public void setStartIndex(int index) {
+ setIndex(index);
}
// ------------------------------------------------------------------------
@Override
// All requests have a unique id
public int hashCode() {
- return getRequestId();
+ return getRequestId();
}
@Override
public boolean equals(Object other) {
- if (other instanceof TmfEventRequest) {
- TmfEventRequest request = (TmfEventRequest) other;
- return super.equals(other) && request.fRange.equals(fRange);
- }
- return false;
+ if (other instanceof TmfEventRequest) {
+ TmfEventRequest request = (TmfEventRequest) other;
+ return super.equals(other) && request.fRange.equals(fRange);
+ }
+ return false;
}
@Override
name = name.substring(dot + 1);
}
return "[" + name + "(" + getRequestId() + "," + getDataType().getSimpleName() + "," + getExecType()
- + "," + getRange() + "," + getIndex() + "," + getNbRequested() + "," + getBlockSize() + ")]";
+ + "," + getRange() + "," + getIndex() + "," + getNbRequested() + ")]";
}
}
* Object sending this signal
* @param range
* The new time range
- * @since 2.1
+ * @since 3.0
*/
public TmfRangeSynchSignal(Object source, TmfTimeRange range) {
super(source);
* Timestamp of begin of selection range
* @param end
* Timestamp of end of selection range
- * @since 2.1
+ * @since 3.0
*/
public TmfTimeSynchSignal(Object source, ITmfTimestamp begin, ITmfTimestamp end) {
super(source);
/**
* @return The begin timestamp of selection
- * @since 2.1
+ * @since 3.0
*/
public ITmfTimestamp getBeginTime() {
return fBeginTime;
/**
* @return The end timestamp of selection
- * @since 2.1
+ * @since 3.0
*/
public ITmfTimestamp getEndTime() {
return fEndTime;
private long total;
public StatsTotalRequest(ITmfTrace trace, TmfTimeRange range) {
- super(trace.getEventType(), range, TmfDataRequest.ALL_DATA,
- trace.getCacheSize(), ITmfDataRequest.ExecutionType.BACKGROUND);
+ super(trace.getEventType(), range, 0, TmfDataRequest.ALL_DATA,
+ ITmfDataRequest.ExecutionType.BACKGROUND);
total = 0;
}
private final Map<String, Long> stats;
public StatsPerTypeRequest(ITmfTrace trace, TmfTimeRange range) {
- super(trace.getEventType(), range, TmfDataRequest.ALL_DATA,
- trace.getCacheSize(), ITmfDataRequest.ExecutionType.BACKGROUND);
+ super(trace.getEventType(), range, 0, TmfDataRequest.ALL_DATA,
+ ITmfDataRequest.ExecutionType.BACKGROUND);
this.stats = new HashMap<String, Long>();
}
new TmfTimeRange(
new TmfTimestamp(borders[0], SCALE),
new TmfTimestamp(endTime, SCALE)),
+ 0,
TmfDataRequest.ALL_DATA,
- trace.getCacheSize(),
ITmfDataRequest.ExecutionType.BACKGROUND);
/* Prepare the results map, with all counts at 0 */
package org.eclipse.linuxtools.tmf.core.timestamp;
/**
- * @since 2.1
+ * @since 3.0
*/
@SuppressWarnings({ "javadoc", "nls" })
public interface ITmfTimePreferencesConstants {
/**
* A simplified timestamp where scale is nanoseconds and precision is set to 0.
*
- * @since 2.1
+ * @since 3.0
*/
public class TmfNanoTimestamp extends TmfTimestamp {
*
* @author Francois Chouinard
* @version 1.0
- * @since 2.1
+ * @since 3.0
*/
public class TmfTimePreferences {
*
* @param pattern the format pattern
* @param timeZone the time zone
- * @since 2.1
+ * @since 3.0
*/
public TmfTimestampFormat(String pattern, TimeZone timeZone) {
setTimeZone(timeZone);
// ------------------------------------------------------------------------
/**
- * @since 2.1
+ * @since 3.0
*/
public static void updateDefaultFormats() {
fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone());
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Patrick Tasse - Updated for location in checkpoint
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
- * to associate a trace location to an event timestamp.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTimestamp
- * @see ITmfLocation
- */
-public interface ITmfCheckpoint extends Comparable<ITmfCheckpoint> {
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * @return the timestamp of the event referred to by the context
- * @since 2.0
- */
- ITmfTimestamp getTimestamp();
-
- /**
- * @return the location of the event referred to by the checkpoint
- */
- ITmfLocation getLocation();
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- int compareTo(ITmfCheckpoint checkpoint);
-
-}
package org.eclipse.linuxtools.tmf.core.trace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
/**
* The basic trace context structure in TMF. The purpose of the context is to
* associate a trace location to an event at a specific rank (order).
/**
* @return the location of the event at the context rank
+ * @since 3.0
*/
ITmfLocation getLocation();
/**
* @param location the new location
+ * @since 3.0
*/
void setLocation(ITmfLocation location);
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2012 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Trace Model 1.0
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-/**
- * The generic trace location in TMF.
- * <p>
- * An ITmfLocation is the equivalent of a random-access file position, holding
- * enough information to allow the positioning of the trace 'pointer' to read an
- * arbitrary event.
- * <p>
- * This location is trace-specific, must be comparable and immutable.
- *
- * @version 2.0
- * @author Francois Chouinard
- */
-public interface ITmfLocation {
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * Returns the concrete trace location information
- *
- * @return the location information
- * @since 2.0
- */
- Comparable<?> getLocationInfo();
-
-}
import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* The event stream structure in TMF. In its basic form, a trace has:
/**
* @return the current trace location
+ * @since 3.0
*/
ITmfLocation getCurrentLocation();
*
* @param location a trace specific location
* @return a floating-point number between 0.0 (beginning) and 1.0 (end)
+ * @since 3.0
*/
double getLocationRatio(ITmfLocation location);
* <p>
* @param location the trace specific location
* @return a context which can later be used to read the corresponding event
+ * @since 3.0
*/
ITmfContext seekEvent(ITmfLocation location);
* @since 2.0
*/
ITmfTimestamp getInitialRangeOffset();
+
+ /**
+ * Returns the ID of the host this trace is from. The host ID is not
+ * necessarily the hostname, but should be a unique identifier for the
+ * machine on which the trace was taken. It can be used to determine if two
+ * traces were taken on the exact same machine (timestamp are already
+ * synchronized, resources with same id are the same if taken at the same
+ * time, etc).
+ *
+ * @return The host id of this trace
+ * @since 3.0
+ */
+ String getHostId();
+
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-
-/**
- * The generic trace indexer in TMF with support for incremental indexing.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTrace
- * @see ITmfEvent
- */
-public interface ITmfTraceIndexer {
-
- /**
- * Start an asynchronous index building job and waits for the job completion
- * if required. Typically, the indexing job sends notifications at regular
- * intervals to indicate its progress.
- * <p>
- * <b>Example 1</b>: Index a whole trace asynchronously
- *
- * <pre>
- * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
- * </pre>
- *
- * <b>Example 2</b>: Index a whole trace synchronously
- *
- * <pre>
- * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
- * </pre>
- *
- * <b>Example 3</b>: Index a trace asynchronously, starting at rank 100
- *
- * <pre>
- * trace.getIndexer().buildIndex(100, TmfTimeRange.ETERNITY, false);
- * </pre>
- *
- * <b>Example 4</b>: Index a trace asynchronously, starting at rank 100 for
- * events between T1 and T2 (inclusive). This is used for incremental
- * indexing.
- *
- * <pre>
- * TmfTimeRange range = new TmfTimeRange(T1, T2);
- * trace.getIndexer().buildIndex(100, range, false);
- * </pre>
- *
- * @param offset
- * The offset of the first event to consider
- * @param range
- * The time range to consider
- * @param waitForCompletion
- * Should we block the calling thread until the build is
- * complete?
- * @since 2.0
- */
- void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
-
- /**
- * Indicates that the indexer is busy indexing the trace.
- * Will always return false if the indexing is done synchronously.
- *
- * @return the state of the indexer (indexing or not)
- */
- boolean isIndexing();
-
- /**
- * Adds an entry to the trace index.
- *
- * @param context The trace context to save
- * @param timestamp The timestamp matching this context
- * @since 2.0
- */
- void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
-
- /**
- * Returns the context of the checkpoint immediately preceding the requested
- * timestamp (or at the timestamp if it coincides with a checkpoint).
- *
- * @param timestamp the requested timestamp
- * @return the checkpoint context
- * @since 2.0
- */
- ITmfContext seekIndex(ITmfTimestamp timestamp);
-
- /**
- * Returns the context of the checkpoint immediately preceding the requested
- * rank (or at rank if it coincides with a checkpoint).
- *
- * @param rank the requested event rank
- * @return the checkpoint context
- */
- ITmfContext seekIndex(long rank);
-
- /**
- * Perform cleanup when the indexer is no longer required.
- */
- void dispose();
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Trace Model 1.0
- * Patrick Tasse - Updated for location in checkpoint
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * A basic implementation of ITmfCheckpoint. It simply maps an event timestamp
- * to a generic location.
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfLocation
- * @see ITmfTimestamp
- */
-public class TmfCheckpoint implements ITmfCheckpoint {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- // The checkpoint location
- private final ITmfLocation fLocation;
-
- // The checkpoint timestamp
- private final ITmfTimestamp fTimestamp;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Full constructor
- *
- * @param timestamp the checkpoint timestamp
- * @param location the corresponding trace location
- * @since 2.0
- */
- public TmfCheckpoint(final ITmfTimestamp timestamp, final ITmfLocation location) {
- fTimestamp = timestamp;
- fLocation = location;
- }
-
- /**
- * Copy constructor
- *
- * @param other the other checkpoint
- */
- public TmfCheckpoint(final TmfCheckpoint other) {
- if (other == null) {
- throw new IllegalArgumentException();
- }
- fTimestamp = other.fTimestamp;
- fLocation = other.fLocation;
- }
-
- // ------------------------------------------------------------------------
- // ITmfCheckpoint
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public ITmfTimestamp getTimestamp() {
- return fTimestamp;
- }
-
- @Override
- public ITmfLocation getLocation() {
- return fLocation;
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public int compareTo(final ITmfCheckpoint other) {
- int comp = 0;
- if ((fTimestamp != null) && (other.getTimestamp() != null)) {
- comp = fTimestamp.compareTo(other.getTimestamp(), false);
- if (comp != 0) {
- return comp;
- }
- // compare locations if timestamps are the same
- }
-
- if ((fLocation == null) && (other.getLocation() == null)) {
- return 0;
- }
-
- // treat location of other as null location which is before any location
- if ((fLocation != null) && (other.getLocation() == null)) {
- return 1;
- }
-
- // treat this as null location which is before any other locations
- if ((fLocation == null) && (other.getLocation() != null)) {
- return -1;
- }
-
- // compare location
- final Comparable location1 = getLocation().getLocationInfo();
- final Comparable location2 = other.getLocation().getLocationInfo();
- return location1.compareTo(location2);
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLocation == null) ? 0 : fLocation.hashCode());
- result = prime * result + ((fTimestamp == null) ? 0 : fTimestamp.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof TmfCheckpoint)) {
- return false;
- }
- final TmfCheckpoint other = (TmfCheckpoint) obj;
- if (fLocation == null) {
- if (other.fLocation != null) {
- return false;
- }
- } else if (!fLocation.equals(other.fLocation)) {
- return false;
- }
- if (fTimestamp == null) {
- if (other.fTimestamp != null) {
- return false;
- }
- } else if (!fTimestamp.equals(other.fTimestamp)) {
- return false;
- }
- return true;
- }
-
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]";
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.linuxtools.internal.tmf.core.Messages;
-import org.eclipse.linuxtools.tmf.core.component.TmfDataProvider;
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
-import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-
-/**
- * A simple indexer that manages the trace index as an array of trace
- * checkpoints. Checkpoints are stored at fixed intervals (event rank) in
- * ascending timestamp order.
- * <p>
- * The goal being to access a random trace event reasonably fast from the user's
- * standpoint, picking the right interval value becomes a trade-off between speed
- * and memory usage (a shorter inter-event interval is faster but requires more
- * checkpoints).
- * <p>
- * Locating a specific checkpoint is trivial for both rank (rank % interval) and
- * timestamp (bsearch in the array).
- *
- * @version 1.0
- * @author Francois Chouinard
- *
- * @see ITmfTrace
- * @see ITmfEvent
- */
-public class TmfCheckpointIndexer implements ITmfTraceIndexer {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /** The event trace to index */
- protected final ITmfTrace fTrace;
-
- /** The interval between checkpoints */
- private final int fCheckpointInterval;
-
- /** The event trace to index */
- private boolean fIsIndexing;
-
- /**
- * The trace index. It is composed of checkpoints taken at intervals of
- * fCheckpointInterval events.
- */
- protected final List<ITmfCheckpoint> fTraceIndex;
-
- /**
- * The indexing request
- */
- private ITmfEventRequest fIndexingRequest = null;
-
- // ------------------------------------------------------------------------
- // Construction
- // ------------------------------------------------------------------------
-
- /**
- * Basic constructor that uses the default trace block size as checkpoints
- * intervals
- *
- * @param trace the trace to index
- */
- public TmfCheckpointIndexer(final ITmfTrace trace) {
- this(trace, TmfDataProvider.DEFAULT_BLOCK_SIZE);
- }
-
- /**
- * Full trace indexer
- *
- * @param trace the trace to index
- * @param interval the checkpoints interval
- */
- public TmfCheckpointIndexer(final ITmfTrace trace, final int interval) {
- fTrace = trace;
- fCheckpointInterval = interval;
- fTraceIndex = new ArrayList<ITmfCheckpoint>();
- fIsIndexing = false;
- }
-
- @Override
- public void dispose() {
- if ((fIndexingRequest != null) && !fIndexingRequest.isCompleted()) {
- fIndexingRequest.cancel();
- fTraceIndex.clear();
- }
- }
-
- // ------------------------------------------------------------------------
- // ITmfTraceIndexer - isIndexing
- // ------------------------------------------------------------------------
-
- @Override
- public boolean isIndexing() {
- return fIsIndexing;
- }
-
- // ------------------------------------------------------------------------
- // ITmfTraceIndexer - buildIndex
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
-
- // Don't do anything if we are already indexing
- synchronized (fTraceIndex) {
- if (fIsIndexing) {
- return;
- }
- fIsIndexing = true;
- }
-
- // The monitoring job
- final Job job = new Job("Indexing " + fTrace.getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- while (!monitor.isCanceled()) {
- try {
- long prevNbEvents = fTrace.getNbEvents();
- Thread.sleep(250);
- long nbEvents = fTrace.getNbEvents();
- setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + nbEvents + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- // setName doesn't refresh the UI, setTaskName does
- long rate = (nbEvents - prevNbEvents) * 4;
- monitor.setTaskName(rate + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); //$NON-NLS-1$
- } catch (final InterruptedException e) {
- return Status.OK_STATUS;
- }
- }
- monitor.done();
- return Status.OK_STATUS;
- }
- };
- job.schedule();
-
- // Build a background request for all the trace data. The index is
- // updated as we go by readNextEvent().
- fIndexingRequest = new TmfEventRequest(ITmfEvent.class,
- range, offset, TmfDataRequest.ALL_DATA, fCheckpointInterval, ITmfDataRequest.ExecutionType.BACKGROUND)
- {
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- if (event != null) {
- // Update the trace status at regular intervals
- if ((getNbRead() % fCheckpointInterval) == 0) {
- updateTraceStatus();
- }
- }
- }
-
- @Override
- public void handleSuccess() {
- updateTraceStatus();
- }
-
- @Override
- public void handleCompleted() {
- job.cancel();
- super.handleCompleted();
- fIsIndexing = false;
- }
-
- private void updateTraceStatus() {
- if (fTrace.getNbEvents() > 0) {
- signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime());
- }
- }
- };
-
- // Submit the request and wait for completion if required
- fTrace.sendRequest(fIndexingRequest);
- if (waitForCompletion) {
- try {
- fIndexingRequest.waitForCompletion();
- } catch (final InterruptedException e) {
- }
- }
- }
-
- /**
- * Notify the interested parties that the trace time range has changed
- *
- * @param startTime the new start time
- * @param endTime the new end time
- */
- private void signalNewTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
- fTrace.broadcast(new TmfTraceUpdatedSignal(fTrace, fTrace, new TmfTimeRange(startTime, endTime)));
- }
-
- // ------------------------------------------------------------------------
- // ITmfTraceIndexer - updateIndex
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) {
- if ((context.getRank() % fCheckpointInterval) == 0) {
- // Determine the table position
- final long position = context.getRank() / fCheckpointInterval;
- // Add new entry at proper location (if empty)
- if (fTraceIndex.size() == position) {
- fTraceIndex.add(new TmfCheckpoint(timestamp, context.getLocation()));
- }
- }
- }
-
- // ------------------------------------------------------------------------
- // ITmfTraceIndexer - seekIndex
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public synchronized ITmfContext seekIndex(final ITmfTimestamp timestamp) {
-
- // A null timestamp indicates to seek the first event
- if (timestamp == null) {
- return fTrace.seekEvent(0);
- }
-
- // Find the checkpoint at or before the requested timestamp.
- // In the very likely event that the timestamp is not at a checkpoint
- // boundary, bsearch will return index = (- (insertion point + 1)).
- // It is then trivial to compute the index of the previous checkpoint.
- int index = Collections.binarySearch(fTraceIndex, new TmfCheckpoint(timestamp, null));
- if (index < 0) {
- index = Math.max(0, -(index + 2));
- } else {
- // If timestamp was in the list, use previous index to be able to find the
- // first event with the same timestamp before the checkpoint
- index = Math.max(0, index - 1);
- }
-
- // Position the trace at the checkpoint
- return restoreCheckpoint(index);
- }
-
- @Override
- public ITmfContext seekIndex(final long rank) {
-
- // A rank < 0 indicates to seek the first event
- if (rank < 0) {
- return fTrace.seekEvent(0);
- }
-
- // Find the checkpoint at or before the requested rank.
- final int index = (int) rank / fCheckpointInterval;
-
- // Position the trace at the checkpoint
- return restoreCheckpoint(index);
- }
-
- /**
- * Position the trace at the given checkpoint
- *
- * @param checkpoint the checkpoint index
- * @return the corresponding context
- */
- private ITmfContext restoreCheckpoint(final int checkpoint) {
- ITmfLocation location = null;
- int index = 0;
- synchronized (fTraceIndex) {
- if (!fTraceIndex.isEmpty()) {
- index = checkpoint;
- if (index >= fTraceIndex.size()) {
- index = fTraceIndex.size() - 1;
- }
- location = fTraceIndex.get(index).getLocation();
- }
- }
- final ITmfContext context = fTrace.seekEvent(location);
- context.setRank((long) index * fCheckpointInterval);
- return context;
- }
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * @return the trace index
- */
- protected List<ITmfCheckpoint> getTraceIndex() {
- return fTraceIndex;
- }
-
-}
package org.eclipse.linuxtools.tmf.core.trace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
/**
* A basic implementation of ITmfContext.
* <p>
* Simple constructor (unknown rank)
*
* @param location the event location
+ * @since 3.0
*/
public TmfContext(final ITmfLocation location) {
this(location, UNKNOWN_RANK);
*
* @param location the event location
* @param rank the event rank
+ * @since 3.0
*/
public TmfContext(final ITmfLocation location, final long rank) {
fLocation = location;
// ITmfContext
// ------------------------------------------------------------------------
+ /**
+ * @since 3.0
+ */
@Override
public ITmfLocation getLocation() {
return fLocation;
}
+ /**
+ * @since 3.0
+ */
@Override
public void setLocation(final ITmfLocation location) {
fLocation = location;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* TmfExperiment presents a time-ordered, unified view of a set of ITmfTrace:s
// ITmfTrace trace positioning
// ------------------------------------------------------------------------
+ /**
+ * @since 3.0
+ */
@Override
public synchronized ITmfContext seekEvent(final ITmfLocation location) {
// Validate the location
return context;
}
+ /**
+ * @since 3.0
+ */
@Override
public double getLocationRatio(final ITmfLocation location) {
if (location instanceof TmfExperimentLocation) {
return 0.0;
}
+ /**
+ * @since 3.0
+ */
@Override
public ITmfLocation getCurrentLocation() {
// never used
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Francois Chouinard - Updated as per TMF Trace Model 1.0
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-
-/**
- * A abstract implementation of ITmfLocation. The concrete classes must provide
- * comparable location information.
- *
- * @version 2.0
- * @author Francois Chouinard
- */
-public abstract class TmfLocation implements ITmfLocation {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final Comparable<?> fLocationInfo;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Standard constructor.
- *
- * @param locationInfo
- * The concrete trace location
- */
- public TmfLocation(final Comparable<?> locationInfo) {
- fLocationInfo = locationInfo;
- }
-
- /**
- * Copy constructor
- *
- * @param location
- * The original trace location
- */
- public TmfLocation(final TmfLocation location) {
- fLocationInfo = location.fLocationInfo;
- }
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * @since 2.0
- */
- @Override
- public Comparable<?> getLocationInfo() {
- return fLocationInfo;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLocationInfo != null) ? fLocationInfo.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TmfLocation other = (TmfLocation) obj;
- if (fLocationInfo == null) {
- if (other.fLocationInfo != null) {
- return false;
- }
- } else if (!fLocationInfo.equals(other.fLocationInfo)) {
- return false;
- }
- return true;
- }
-
- @Override
- @SuppressWarnings("nls")
- public String toString() {
- return getClass().getSimpleName() + " [fLocationInfo=" + fLocationInfo + "]";
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-/**
- * A concrete implementation of TmfLocation based on Long:s
- *
- * @author Francois Chouinard
- * @since 2.0
- */
-public final class TmfLongLocation extends TmfLocation {
-
- /**
- * The normal constructor
- *
- * @param locationInfo the concrete location
- */
- public TmfLongLocation(final Long locationInfo) {
- super(locationInfo);
- }
-
- /**
- * The copy constructor
- *
- * @param other the other location
- */
- public TmfLongLocation(final TmfLongLocation other) {
- super(other.getLocationInfo());
- }
-
- @Override
- public Long getLocationInfo() {
- return (Long) super.getLocationInfo();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.core.trace;
-
-import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
-
-/**
- * A concrete implementation of TmfLocation based on ITmfTimestamp:s
- *
- * @author Francois Chouinard
- * @since 2.0
- */
-public final class TmfTimestampLocation extends TmfLocation {
-
- /**
- * The normal constructor
- *
- * @param locationInfo the concrete location
- */
- public TmfTimestampLocation(final ITmfTimestamp locationInfo) {
- super(locationInfo);
- }
-
- /**
- * The copy constructor
- *
- * @param other the other location
- */
- public TmfTimestampLocation(final TmfTimestampLocation other) {
- super(other.getLocationInfo());
- }
-
- @Override
- public ITmfTimestamp getLocationInfo() {
- return (ITmfTimestamp) super.getLocationInfo();
- }
-
-}
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.linuxtools.internal.tmf.core.Activator;
import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* Abstract implementation of ITmfTrace.
* The default implementation of TmfTrace uses a TmfStatistics back-end.
* Override this if you want to specify another type (or none at all).
*
- * @throws TmfTraceException
- * If there was a problem setting up the statistics
- * @since 2.0
+ * @return An IStatus indicating if the statistics could be built
+ * successfully or not.
+ * @since 3.0
*/
- protected void buildStatistics() throws TmfTraceException {
+ protected IStatus buildStatistics() {
/*
* Initialize the statistics provider, but only if a Resource has been
* set (so we don't build it for experiments, for unit tests, etc.)
*/
- fStatistics = (fResource == null ? null : new TmfStateStatistics(this) );
+ try {
+ fStatistics = (fResource == null ? null : new TmfStateStatistics(this) );
+ } catch (TmfTraceException e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ }
+ return Status.OK_STATUS;
}
/**
* Suppressing the warning, because the 'throws' will usually happen in
* sub-classes.
*
- * @throws TmfTraceException
- * If there is a problem during the build
- * @since 2.0
+ * @return An IStatus indicating if the state system could be build
+ * successfully or not.
+ * @since 3.0
*/
- @SuppressWarnings("unused")
- protected void buildStateSystem() throws TmfTraceException {
+ protected IStatus buildStateSystem() {
/*
* Nothing is done in the base implementation, please specify
* how/if to register a new state system in derived classes.
*/
- return;
+ return Status.OK_STATUS;
}
/**
/**
* @return the trace indexer
+ * @since 3.0
*/
protected ITmfTraceIndexer getIndexer() {
return fIndexer;
return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE, ITmfTimestamp.NANOSECOND_SCALE);
}
+ /**
+ * @since 3.0
+ */
+ @Override
+ public String getHostId() {
+ return this.getName();
+ }
+
// ------------------------------------------------------------------------
// Convenience setters
// ------------------------------------------------------------------------
* Set the trace indexer. Must be done at initialization time.
*
* @param indexer the trace indexer
+ * @since 3.0
*/
protected void setIndexer(final ITmfTraceIndexer indexer) {
fIndexer = indexer;
* The signal is either for this trace, or for an experiment containing
* this trace.
*/
- try {
- buildStatistics();
- buildStateSystem();
- } catch (TmfTraceException e) {
- e.printStackTrace();
+ MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
+ status.add(buildStatistics());
+ status.add(buildStateSystem());
+ if (!status.isOK()) {
+ Activator.log(status);
}
/* Refresh the project, so it can pick up new files that got created. */
/**
* @return The begin timestamp of selection
- * @since 2.1
+ * @since 3.0
*/
public ITmfTimestamp getSelectionBeginTime() {
return getCurrentTraceContext().getSelectionBegin();
/**
* @return The end timestamp of selection
- * @since 2.1
+ * @since 3.0
*/
public ITmfTimestamp getSelectionEndTime() {
return getCurrentTraceContext().getSelectionEnd();
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer;
+
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+
+/**
+ * The generic trace indexer in TMF with support for incremental indexing.
+ *
+ * @see ITmfTrace
+ * @see ITmfEvent
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfTraceIndexer {
+
+ /**
+ * Start an asynchronous index building job and waits for the job completion
+ * if required. Typically, the indexing job sends notifications at regular
+ * intervals to indicate its progress.
+ * <p>
+ * <b>Example 1</b>: Index a whole trace asynchronously
+ *
+ * <pre>
+ * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
+ * </pre>
+ *
+ * <b>Example 2</b>: Index a whole trace synchronously
+ *
+ * <pre>
+ * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
+ * </pre>
+ *
+ * <b>Example 3</b>: Index a trace asynchronously, starting at rank 100
+ *
+ * <pre>
+ * trace.getIndexer().buildIndex(100, TmfTimeRange.ETERNITY, false);
+ * </pre>
+ *
+ * <b>Example 4</b>: Index a trace asynchronously, starting at rank 100 for
+ * events between T1 and T2 (inclusive). This is used for incremental
+ * indexing.
+ *
+ * <pre>
+ * TmfTimeRange range = new TmfTimeRange(T1, T2);
+ * trace.getIndexer().buildIndex(100, range, false);
+ * </pre>
+ *
+ * @param offset
+ * The offset of the first event to consider
+ * @param range
+ * The time range to consider
+ * @param waitForCompletion
+ * Should we block the calling thread until the build is
+ * complete?
+ * @since 2.0
+ */
+ void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
+
+ /**
+ * Indicates that the indexer is busy indexing the trace.
+ * Will always return false if the indexing is done synchronously.
+ *
+ * @return the state of the indexer (indexing or not)
+ */
+ boolean isIndexing();
+
+ /**
+ * Adds an entry to the trace index.
+ *
+ * @param context The trace context to save
+ * @param timestamp The timestamp matching this context
+ * @since 2.0
+ */
+ void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
+
+ /**
+ * Returns the context of the checkpoint immediately preceding the requested
+ * timestamp (or at the timestamp if it coincides with a checkpoint).
+ *
+ * @param timestamp the requested timestamp
+ * @return the checkpoint context
+ * @since 2.0
+ */
+ ITmfContext seekIndex(ITmfTimestamp timestamp);
+
+ /**
+ * Returns the context of the checkpoint immediately preceding the requested
+ * rank (or at rank if it coincides with a checkpoint).
+ *
+ * @param rank the requested event rank
+ * @return the checkpoint context
+ */
+ ITmfContext seekIndex(long rank);
+
+ /**
+ * Perform cleanup when the indexer is no longer required.
+ */
+ void dispose();
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Patrick Tasse - Updated for location in checkpoint
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * The basic trace checkpoint structure in TMF. The purpose of the checkpoint is
+ * to associate a trace location to an event timestamp.
+ * *
+ * @see ITmfTimestamp
+ * @see ITmfLocation
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfCheckpoint extends Comparable<ITmfCheckpoint> {
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the timestamp of the event referred to by the context
+ * @since 2.0
+ */
+ ITmfTimestamp getTimestamp();
+
+ /**
+ * @return the location of the event referred to by the checkpoint
+ */
+ ITmfLocation getLocation();
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ int compareTo(ITmfCheckpoint checkpoint);
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Trace Model 1.0
+ * Patrick Tasse - Updated for location in checkpoint
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * A basic implementation of ITmfCheckpoint. It simply maps an event timestamp
+ * to a generic location.
+ *
+ * @see ITmfLocation
+ * @see ITmfTimestamp
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public class TmfCheckpoint implements ITmfCheckpoint {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ // The checkpoint location
+ private final ITmfLocation fLocation;
+
+ // The checkpoint timestamp
+ private final ITmfTimestamp fTimestamp;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Full constructor
+ *
+ * @param timestamp the checkpoint timestamp
+ * @param location the corresponding trace location
+ * @since 3.0
+ */
+ public TmfCheckpoint(final ITmfTimestamp timestamp, final ITmfLocation location) {
+ fTimestamp = timestamp;
+ fLocation = location;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param other the other checkpoint
+ */
+ public TmfCheckpoint(final TmfCheckpoint other) {
+ if (other == null) {
+ throw new IllegalArgumentException();
+ }
+ fTimestamp = other.fTimestamp;
+ fLocation = other.fLocation;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfCheckpoint
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public ITmfTimestamp getTimestamp() {
+ return fTimestamp;
+ }
+
+ @Override
+ public ITmfLocation getLocation() {
+ return fLocation;
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public int compareTo(final ITmfCheckpoint other) {
+ int comp = 0;
+ if ((fTimestamp != null) && (other.getTimestamp() != null)) {
+ comp = fTimestamp.compareTo(other.getTimestamp(), false);
+ if (comp != 0) {
+ return comp;
+ }
+ // compare locations if timestamps are the same
+ }
+
+ if ((fLocation == null) && (other.getLocation() == null)) {
+ return 0;
+ }
+
+ // treat location of other as null location which is before any location
+ if ((fLocation != null) && (other.getLocation() == null)) {
+ return 1;
+ }
+
+ // treat this as null location which is before any other locations
+ if ((fLocation == null) && (other.getLocation() != null)) {
+ return -1;
+ }
+
+ // compare location
+ final Comparable location1 = getLocation().getLocationInfo();
+ final Comparable location2 = other.getLocation().getLocationInfo();
+ return location1.compareTo(location2);
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fLocation == null) ? 0 : fLocation.hashCode());
+ result = prime * result + ((fTimestamp == null) ? 0 : fTimestamp.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof TmfCheckpoint)) {
+ return false;
+ }
+ final TmfCheckpoint other = (TmfCheckpoint) obj;
+ if (fLocation == null) {
+ if (other.fLocation != null) {
+ return false;
+ }
+ } else if (!fLocation.equals(other.fLocation)) {
+ return false;
+ }
+ if (fTimestamp == null) {
+ if (other.fTimestamp != null) {
+ return false;
+ }
+ } else if (!fTimestamp.equals(other.fTimestamp)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ return getClass().getSimpleName() + " [fLocation=" + fLocation + ", fTimestamp=" + fTimestamp + "]";
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.internal.tmf.core.Messages;
+import org.eclipse.linuxtools.tmf.core.component.TmfDataProvider;
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
+import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest;
+import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+
+/**
+ * A simple indexer that manages the trace index as an array of trace
+ * checkpoints. Checkpoints are stored at fixed intervals (event rank) in
+ * ascending timestamp order.
+ * <p>
+ * The goal being to access a random trace event reasonably fast from the user's
+ * standpoint, picking the right interval value becomes a trade-off between speed
+ * and memory usage (a shorter inter-event interval is faster but requires more
+ * checkpoints).
+ * <p>
+ * Locating a specific checkpoint is trivial for both rank (rank % interval) and
+ * timestamp (bsearch in the array).
+ * *
+ * @see ITmfTrace
+ * @see ITmfEvent
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public class TmfCheckpointIndexer implements ITmfTraceIndexer {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /** The event trace to index */
+ protected final ITmfTrace fTrace;
+
+ /** The interval between checkpoints */
+ private final int fCheckpointInterval;
+
+ /** The event trace to index */
+ private boolean fIsIndexing;
+
+ /**
+ * The trace index. It is composed of checkpoints taken at intervals of
+ * fCheckpointInterval events.
+ */
+ protected final List<ITmfCheckpoint> fTraceIndex;
+
+ /**
+ * The indexing request
+ */
+ private ITmfEventRequest fIndexingRequest = null;
+
+ // ------------------------------------------------------------------------
+ // Construction
+ // ------------------------------------------------------------------------
+
+ /**
+ * Basic constructor that uses the default trace block size as checkpoints
+ * intervals
+ *
+ * @param trace the trace to index
+ */
+ public TmfCheckpointIndexer(final ITmfTrace trace) {
+ this(trace, TmfDataProvider.DEFAULT_BLOCK_SIZE);
+ }
+
+ /**
+ * Full trace indexer
+ *
+ * @param trace the trace to index
+ * @param interval the checkpoints interval
+ */
+ public TmfCheckpointIndexer(final ITmfTrace trace, final int interval) {
+ fTrace = trace;
+ fCheckpointInterval = interval;
+ fTraceIndex = new ArrayList<ITmfCheckpoint>();
+ fIsIndexing = false;
+ }
+
+ @Override
+ public void dispose() {
+ if ((fIndexingRequest != null) && !fIndexingRequest.isCompleted()) {
+ fIndexingRequest.cancel();
+ fTraceIndex.clear();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTraceIndexer - isIndexing
+ // ------------------------------------------------------------------------
+
+ @Override
+ public boolean isIndexing() {
+ return fIsIndexing;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTraceIndexer - buildIndex
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) {
+
+ // Don't do anything if we are already indexing
+ synchronized (fTraceIndex) {
+ if (fIsIndexing) {
+ return;
+ }
+ fIsIndexing = true;
+ }
+
+ // The monitoring job
+ final Job job = new Job("Indexing " + fTrace.getName() + "...") { //$NON-NLS-1$ //$NON-NLS-2$
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
+ while (!monitor.isCanceled()) {
+ try {
+ long prevNbEvents = fTrace.getNbEvents();
+ Thread.sleep(250);
+ long nbEvents = fTrace.getNbEvents();
+ setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + nbEvents + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ // setName doesn't refresh the UI, setTaskName does
+ long rate = (nbEvents - prevNbEvents) * 4;
+ monitor.setTaskName(rate + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); //$NON-NLS-1$
+ } catch (final InterruptedException e) {
+ return Status.OK_STATUS;
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+
+ // Build a background request for all the trace data. The index is
+ // updated as we go by readNextEvent().
+ fIndexingRequest = new TmfEventRequest(ITmfEvent.class,
+ range, offset, TmfDataRequest.ALL_DATA,
+ ITmfDataRequest.ExecutionType.BACKGROUND) {
+ @Override
+ public void handleData(final ITmfEvent event) {
+ super.handleData(event);
+ if (event != null) {
+ // Update the trace status at regular intervals
+ if ((getNbRead() % fCheckpointInterval) == 0) {
+ updateTraceStatus();
+ }
+ }
+ }
+
+ @Override
+ public void handleSuccess() {
+ updateTraceStatus();
+ }
+
+ @Override
+ public void handleCompleted() {
+ job.cancel();
+ super.handleCompleted();
+ fIsIndexing = false;
+ }
+
+ private void updateTraceStatus() {
+ if (fTrace.getNbEvents() > 0) {
+ signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime());
+ }
+ }
+ };
+
+ // Submit the request and wait for completion if required
+ fTrace.sendRequest(fIndexingRequest);
+ if (waitForCompletion) {
+ try {
+ fIndexingRequest.waitForCompletion();
+ } catch (final InterruptedException e) {
+ }
+ }
+ }
+
+ /**
+ * Notify the interested parties that the trace time range has changed
+ *
+ * @param startTime the new start time
+ * @param endTime the new end time
+ */
+ private void signalNewTimeRange(final ITmfTimestamp startTime, final ITmfTimestamp endTime) {
+ fTrace.broadcast(new TmfTraceUpdatedSignal(fTrace, fTrace, new TmfTimeRange(startTime, endTime)));
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTraceIndexer - updateIndex
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public synchronized void updateIndex(final ITmfContext context, final ITmfTimestamp timestamp) {
+ if ((context.getRank() % fCheckpointInterval) == 0) {
+ // Determine the table position
+ final long position = context.getRank() / fCheckpointInterval;
+ // Add new entry at proper location (if empty)
+ if (fTraceIndex.size() == position) {
+ fTraceIndex.add(new TmfCheckpoint(timestamp, context.getLocation()));
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfTraceIndexer - seekIndex
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public synchronized ITmfContext seekIndex(final ITmfTimestamp timestamp) {
+
+ // A null timestamp indicates to seek the first event
+ if (timestamp == null) {
+ return fTrace.seekEvent(0);
+ }
+
+ // Find the checkpoint at or before the requested timestamp.
+ // In the very likely event that the timestamp is not at a checkpoint
+ // boundary, bsearch will return index = (- (insertion point + 1)).
+ // It is then trivial to compute the index of the previous checkpoint.
+ int index = Collections.binarySearch(fTraceIndex, new TmfCheckpoint(timestamp, null));
+ if (index < 0) {
+ index = Math.max(0, -(index + 2));
+ } else {
+ // If timestamp was in the list, use previous index to be able to find the
+ // first event with the same timestamp before the checkpoint
+ index = Math.max(0, index - 1);
+ }
+
+ // Position the trace at the checkpoint
+ return restoreCheckpoint(index);
+ }
+
+ @Override
+ public ITmfContext seekIndex(final long rank) {
+
+ // A rank < 0 indicates to seek the first event
+ if (rank < 0) {
+ return fTrace.seekEvent(0);
+ }
+
+ // Find the checkpoint at or before the requested rank.
+ final int index = (int) rank / fCheckpointInterval;
+
+ // Position the trace at the checkpoint
+ return restoreCheckpoint(index);
+ }
+
+ /**
+ * Position the trace at the given checkpoint
+ *
+ * @param checkpoint the checkpoint index
+ * @return the corresponding context
+ */
+ private ITmfContext restoreCheckpoint(final int checkpoint) {
+ ITmfLocation location = null;
+ int index = 0;
+ synchronized (fTraceIndex) {
+ if (!fTraceIndex.isEmpty()) {
+ index = checkpoint;
+ if (index >= fTraceIndex.size()) {
+ index = fTraceIndex.size() - 1;
+ }
+ location = fTraceIndex.get(index).getLocation();
+ }
+ }
+ final ITmfContext context = fTrace.seekEvent(location);
+ context.setRank((long) index * fCheckpointInterval);
+ return context;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the trace index
+ */
+ protected List<ITmfCheckpoint> getTraceIndex() {
+ return fTraceIndex;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Trace Model 1.0
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+/**
+ * The generic trace location in TMF.
+ * <p>
+ * An ITmfLocation is the equivalent of a random-access file position, holding
+ * enough information to allow the positioning of the trace 'pointer' to read an
+ * arbitrary event.
+ * <p>
+ * This location is trace-specific, must be comparable and immutable.
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public interface ITmfLocation {
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the concrete trace location information
+ *
+ * @return the location information
+ * @since 2.0
+ */
+ Comparable<?> getLocationInfo();
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Francois Chouinard - Updated as per TMF Trace Model 1.0
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+
+/**
+ * A abstract implementation of ITmfLocation. The concrete classes must provide
+ * comparable location information.
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public abstract class TmfLocation implements ITmfLocation {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final Comparable<?> fLocationInfo;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Standard constructor.
+ *
+ * @param locationInfo
+ * The concrete trace location
+ */
+ public TmfLocation(final Comparable<?> locationInfo) {
+ fLocationInfo = locationInfo;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param location
+ * The original trace location
+ */
+ public TmfLocation(final TmfLocation location) {
+ fLocationInfo = location.fLocationInfo;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public Comparable<?> getLocationInfo() {
+ return fLocationInfo;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fLocationInfo != null) ? fLocationInfo.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TmfLocation other = (TmfLocation) obj;
+ if (fLocationInfo == null) {
+ if (other.fLocationInfo != null) {
+ return false;
+ }
+ } else if (!fLocationInfo.equals(other.fLocationInfo)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ @SuppressWarnings("nls")
+ public String toString() {
+ return getClass().getSimpleName() + " [fLocationInfo=" + fLocationInfo + "]";
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+
+/**
+ * A concrete implementation of TmfLocation based on Long:s
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public final class TmfLongLocation extends TmfLocation {
+
+ /**
+ * The normal constructor
+ *
+ * @param locationInfo the concrete location
+ */
+ public TmfLongLocation(final Long locationInfo) {
+ super(locationInfo);
+ }
+
+ /**
+ * The copy constructor
+ *
+ * @param other the other location
+ */
+ public TmfLongLocation(final TmfLongLocation other) {
+ super(other.getLocationInfo());
+ }
+
+ @Override
+ public Long getLocationInfo() {
+ return (Long) super.getLocationInfo();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.core.trace.location;
+
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+
+/**
+ * A concrete implementation of TmfLocation based on ITmfTimestamp:s
+ *
+ * @author Francois Chouinard
+ * @since 3.0
+ */
+public final class TmfTimestampLocation extends TmfLocation {
+
+ /**
+ * The normal constructor
+ *
+ * @param locationInfo the concrete location
+ */
+ public TmfTimestampLocation(final ITmfTimestamp locationInfo) {
+ super(locationInfo);
+ }
+
+ /**
+ * The copy constructor
+ *
+ * @param other the other location
+ */
+ public TmfTimestampLocation(final TmfTimestampLocation other) {
+ super(other.getLocationInfo());
+ }
+
+ @Override
+ public ITmfTimestamp getLocationInfo() {
+ return (ITmfTimestamp) super.getLocationInfo();
+ }
+
+}
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.tmf.help; singleton:=true
Require-Bundle: org.eclipse.help
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf.help</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools TMF Help Plug-in</name>
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui.tests;singleton:=true
Bundle-ActivationPolicy: lazy
org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.ui;bundle-version="2.1.0",
- org.eclipse.linuxtools.tmf.core.tests;bundle-version="2.1.0"
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.ui;bundle-version="3.0.0",
+ org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0"
Export-Package: org.eclipse.linuxtools.tmf.ui.tests
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf.ui.tests</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<name>Linux Tools TMF UI Tests Plug-in</name>
// Create test trace object
final URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("tracesets/sdEvents"), null);
final File test = new File(FileLocator.toFileURL(location).toURI());
- return new TmfTraceStub(test.getPath(), 500, true, parser, null);
+ return new TmfTraceStub(test.getPath(), 500, true, null, parser);
} catch (final TmfTraceException e) {
e.printStackTrace();
throw new RuntimeException(e);
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.linuxtools.tmf.ui;singleton:=true
Bundle-Activator: org.eclipse.linuxtools.internal.tmf.ui.Activator
Require-Bundle: org.eclipse.core.expressions,
org.eclipse.core.resources,
org.eclipse.core.runtime,
- org.eclipse.linuxtools.tmf.core;bundle-version="2.1.0",
+ org.eclipse.linuxtools.tmf.core;bundle-version="3.0.0",
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.ui.navigator,
org.eclipse.linuxtools.tmf.ui.views.callstack,
org.eclipse.linuxtools.tmf.ui.views.colors,
org.eclipse.linuxtools.tmf.ui.views.distribution.model,
- org.eclipse.linuxtools.tmf.ui.views.environment,
org.eclipse.linuxtools.tmf.ui.views.filter,
org.eclipse.linuxtools.tmf.ui.views.histogram,
org.eclipse.linuxtools.tmf.ui.views.statesystem,
events.editor.name = Events Editor
uml2sd.view.name = Sequence Diagram
histogram.view.name = Histogram
-environment.view.name = Environment Variables
ssvisualizer.view.name = State System Explorer
callstack.view.name = Call Stack
id="org.eclipse.linuxtools.tmf.ui.views.timechart"
name="%timechart.view.name"
restorable="true">
- </view>
- <view
- allowMultiple="false"
- category="org.eclipse.linuxtools.tmf.ui.views.category"
- class="org.eclipse.linuxtools.tmf.ui.views.environment.TmfEnvironmentView"
- icon="icons/eview16/events_view.gif"
- id="org.eclipse.linuxtools.tmf.ui.views.environment"
- name="%environment.view.name"
- restorable="true">
</view>
<view
allowMultiple="false"
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf.ui</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools TMF UI Plug-in</name>
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
/**
* Base class for custom plain text traces.
import java.util.regex.Matcher;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* Trace context for custom text traces.
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputAttribute;
import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputElement;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceIndexer;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.linuxtools.tmf.core.trace.location.TmfLongLocation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
/**
* Trace context for custom XML traces.
* Message strings for TMF model handling.
*
* @author Jean-Christian Kouamé
- * @since 2.1
+ * @since 3.0
*/
public class Messages extends NLS {
import org.eclipse.osgi.util.NLS;
/**
- * @since 2.1
+ * @since 3.0
*/
@SuppressWarnings("javadoc")
public class Messages extends NLS {
int requestIndex;
DataRequest(Class<? extends ITmfEvent> dataType, ITmfFilter reqFilter, int start, int nbRequested) {
- super(dataType, start, nbRequested);
+ super(dataType, start, nbRequested,
+ TmfDataRequest.ExecutionType.FOREGROUND);
requestFilter = reqFilter;
requestRank = start;
requestIndex = index;
}
}
- TmfDataRequest request = new TmfDataRequest(ITmfEvent.class, startIndex, nbRequested) {
+ TmfDataRequest request = new TmfDataRequest(ITmfEvent.class,
+ startIndex,
+ nbRequested,
+ TmfDataRequest.ExecutionType.FOREGROUND) {
private int count = 0;
private long rank = startIndex;
@Override
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsCache.CachedEvent;
import org.eclipse.linuxtools.tmf.ui.views.colors.ColorSetting;
import org.eclipse.linuxtools.tmf.ui.views.colors.ColorSettingsManager;
return;
}
request = new TmfDataRequest(ITmfEvent.class, (int) fFilterCheckCount,
- nbRequested, fTrace.getCacheSize(), ExecutionType.BACKGROUND) {
+ nbRequested, ExecutionType.BACKGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
if (direction == Direction.BACKWARD) {
rank = Math.max(0, rank - fTrace.getCacheSize() + 1);
}
- request = new TmfDataRequest(ITmfEvent.class, (int) rank, nbRequested, fTrace.getCacheSize(), ExecutionType.BACKGROUND) {
+ request = new TmfDataRequest(ITmfEvent.class, (int) rank, nbRequested, ExecutionType.BACKGROUND) {
long currentRank = rank;
@Override
*
* @param statusLineManager
* The status line manager, or null to disable status line messages
- * @since 2.1
+ * @since 3.0
*/
public void setStatusLineManager(IStatusLineManager statusLineManager) {
if (fStatusLineManager != null && statusLineManager == null) {
// Create a request for one event that will be queued after other ongoing requests. When this request is completed
// do the work to select the actual event with the timestamp specified in the signal. This procedure prevents
// the method fTrace.getRank() from interfering and delaying ongoing requests.
- final TmfDataRequest subRequest = new TmfDataRequest(ITmfEvent.class, 0, 1, ExecutionType.FOREGROUND) {
+ final TmfDataRequest subRequest = new TmfDataRequest(ITmfEvent.class,
+ 0, 1, ExecutionType.FOREGROUND) {
TmfTimestamp ts = new TmfTimestamp(signal.getBeginTime());
*
* @param signal
* Contains the information about the new selected time range.
- * @since 2.1
+ * @since 3.0
*/
@TmfSignalHandler
public void timeSynchUpdated(TmfTimeSynchSignal signal) {
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- * Bernd Hufmann - Updated to use Tree with columns to be able to group traces
- * Alexandre Montplaisir - Display info for any ITmfTraceProperties trace
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.views.environment;
-
-import java.util.Map;
-
-import org.eclipse.linuxtools.tmf.core.signal.TmfSignalHandler;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceClosedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.linuxtools.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTraceProperties;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
-import org.eclipse.linuxtools.tmf.ui.views.TmfView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * Displays the trace's properties.
- *
- * @version 1.1
- * @author Matthew Khouzam
- */
-public class TmfEnvironmentView extends TmfView {
-
- /** The Environment View's ID */
- public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.environment"; //$NON-NLS-1$
-
- private ITmfTrace fTrace;
- private Tree fTree;
-
- /**
- * Default constructor
- */
- public TmfEnvironmentView() {
- super("EnvironmentVariables"); //$NON-NLS-1$
-// fTitlePrefix = getTitle();
- }
-
- // ------------------------------------------------------------------------
- // ViewPart
- // ------------------------------------------------------------------------
-
- @Override
- public void createPartControl(Composite parent) {
- fTree = new Tree(parent, SWT.NONE);
- TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0);
- TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1);
- nameCol.setText("Environment Variable"); //$NON-NLS-1$
- valueCol.setText("Value"); //$NON-NLS-1$
-
- fTree.setItemCount(0);
-
- fTree.setHeaderVisible(true);
- nameCol.pack();
- valueCol.pack();
-
- ITmfTrace trace = getActiveTrace();
- if (trace != null) {
- traceSelected(new TmfTraceSelectedSignal(this, trace));
- }
- }
-
- private void updateTable() {
- fTree.setItemCount(0);
- if (fTrace == null) {
- return;
- }
-
- for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
- if (trace instanceof ITmfTraceProperties) {
- TreeItem item = new TreeItem(fTree, SWT.NONE);
- item.setText(0, trace.getName());
-
- ITmfTraceProperties propTrace = (ITmfTraceProperties) trace;
- Map <String, String> properties = propTrace.getTraceProperties();
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- TreeItem subItem = new TreeItem(item, SWT.NONE);
- subItem.setText(0, entry.getKey()); // Variable name
- subItem.setText(1, entry.getValue()); // Variable value
- }
- }
- }
-
- // Expand the tree items
- for (int i = 0; i < fTree.getItemCount(); i++) {
- fTree.getItem(i).setExpanded(true);
- }
-
- for (TreeColumn column : fTree.getColumns()) {
- column.pack();
- }
- }
-
- @Override
- public void setFocus() {
- fTree.setFocus();
- }
-
- /**
- * Handler for the trace opened signal.
- * @param signal
- * The incoming signal
- * @since 2.0
- */
- @TmfSignalHandler
- public void traceOpened(TmfTraceOpenedSignal signal) {
- fTrace = signal.getTrace();
- updateTable();
- }
-
-
- /**
- * Handler for the trace selected signal.
- *
- * @param signal
- * The incoming signal
- * @since 2.0
- */
- @TmfSignalHandler
- public void traceSelected(TmfTraceSelectedSignal signal) {
- // Update the trace reference
- ITmfTrace trace = signal.getTrace();
- if (!trace.equals(fTrace)) {
- fTrace = trace;
- updateTable();
- }
- }
-
- /**
- * Handler for the trace closed signal.
- *
- * @param signal the incoming signal
- * @since 2.0
- */
- @TmfSignalHandler
- public void traceClosed(TmfTraceClosedSignal signal) {
- if (signal.getTrace() == fTrace) {
- fTrace = null;
- fTree.setItemCount(0);
- }
- }
-
-}
-
* The begin time of the current selection
* @param endTime
* The end time of the current selection
- * @since 2.1
+ * @since 3.0
*/
public void setSelection(final long beginTime, final long endTime) {
fSelectionBegin = (beginTime > 0) ? beginTime : 0;
/**
* Returns the begin time of the current selection in the model.
* @return the begin time of the current selection.
- * @since 2.1
+ * @since 3.0
*/
public long getSelectionBegin() {
return fSelectionBegin;
/**
* Returns the end time of the current selection in the model.
* @return the end time of the current selection.
- * @since 2.1
+ * @since 3.0
*/
public long getSelectionEnd() {
return fSelectionEnd;
*
* @param beginTime The selection begin time.
* @param endTime The selection end time.
- * @since 2.1
+ * @since 3.0
*/
public void setSelection(long beginTime, long endTime) {
fSelectionBegin = beginTime;
*
* @param beginTime The selection begin time.
* @param endTime The selection end time.
- * @since 2.1
+ * @since 3.0
*/
public void setSelectionNotifyListeners(long beginTime, long endTime) {
fSelectionBegin = beginTime;
import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
* Class to request events for given time range from a trace to fill a HistogramDataModel and HistogramView.
public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range,
int rank, int nbEvents, int blockSize,
ITmfDataRequest.ExecutionType execType) {
- super(ITmfEvent.class, range, rank, nbEvents,
- (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE,
- execType);
+ super(ITmfEvent.class, range, rank, nbEvents, execType);
fHistogram = histogram;
}
public int fCurrentBucket;
/**
* The index of the selection begin bucket.
- * @since 2.1
+ * @since 3.0
*/
public int fSelectionBeginBucket;
/**
* The index of the selection end bucket.
- * @since 2.1
+ * @since 3.0
*/
public int fSelectionEndBucket;
/**
public static String ValueColumnLabel;
/** Label for the "type" column
- * @since 2.1*/
+ * @since 3.0*/
public static String TypeColumnLabel;
/** Label for the "start time" column */
public static String OutOfRangeMsg;
/** Label for the Filter button
- * @since 2.1*/
+ * @since 3.0*/
public static String FilterButton;
/** Label for the type Interger
- * @since 2.1*/
+ * @since 3.0*/
public static String TypeInteger;
/** Label for the type Long
- * @since 2.1*/
+ * @since 3.0*/
public static String TypeLong;
/** Label for the type String
- * @since 2.1*/
+ * @since 3.0*/
public static String TypeString;
}
};
thread.start();
}
-
+
/**
* Update the display to use the updated timestamp format
*
* @param signal the incoming signal
- * @since 2.1
+ * @since 3.0
*/
@TmfSignalHandler
public void timestampFormatUpdated(TmfTimestampFormatUpdateSignal signal) {
* left, showing entries and a canvas on the right to draw something for these
* entries.
*
- * @since 2.1
+ * @since 3.0
*/
public abstract class AbstractTimeGraphView extends TmfView {
/**
* Generic messages for the bar charts
*
- * @since 2.1
+ * @since 3.0
*/
@SuppressWarnings("javadoc")
public class Messages extends NLS {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
+
/**
* Default title name.
*/
protected static final String TITLE = Messages.TmfUml2SDSyncLoader_ViewName;
- /**
- * Default block size for background request.
- */
- protected static final int DEFAULT_BLOCK_SIZE = 50000;
+
/**
* Maximum number of messages per page.
*/
TmfTimeRange window = TmfTimeRange.ETERNITY;
- fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, DEFAULT_BLOCK_SIZE, ITmfDataRequest.ExecutionType.BACKGROUND) {
+ fIndexRequest = new TmfEventRequest(ITmfEvent.class, window, 0, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.BACKGROUND) {
private ITmfTimestamp fFirstTime = null;
private ITmfTimestamp fLastTime = null;
window = TmfTimeRange.ETERNITY;
}
- fPageRequest = new TmfEventRequest(ITmfEvent.class, window, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.FOREGROUND) {
+ fPageRequest = new TmfEventRequest(ITmfEvent.class, window, 0, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.FOREGROUND) {
private final List<ITmfSyncSequenceDiagramEvent> fSdEvent = new ArrayList<ITmfSyncSequenceDiagramEvent>();
@Override
*/
public SearchJob(Criteria findCriteria, TmfTimeRange window) {
super(Messages.TmfUml2SDSyncLoader_SearchJobDescrition);
- fSearchRequest = new SearchEventRequest(window, TmfDataRequest.ALL_DATA, 1, ITmfDataRequest.ExecutionType.FOREGROUND, findCriteria);
+ fSearchRequest = new SearchEventRequest(window, TmfDataRequest.ALL_DATA, ITmfDataRequest.ExecutionType.FOREGROUND, findCriteria);
}
@Override
* Constructor
* @param range @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
* @param nbRequested @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
- * @param blockSize @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
* @param execType @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#handleData(...)
* @param criteria The search criteria
*/
- public SearchEventRequest(TmfTimeRange range, int nbRequested, int blockSize, ExecutionType execType, Criteria criteria) {
- this(range, nbRequested, blockSize, execType, criteria, null);
+ public SearchEventRequest(TmfTimeRange range, int nbRequested, ExecutionType execType, Criteria criteria) {
+ this(range, nbRequested, execType, criteria, null);
}
/**
* Constructor
* @param range @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
* @param nbRequested @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
- * @param blockSize @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
* @param execType @see org.eclipse.linuxtools.tmf.request.TmfEventRequest#TmfEventRequest(...)
* @param criteria The search criteria
* @param monitor progress monitor
*/
- public SearchEventRequest(TmfTimeRange range, int nbRequested, int blockSize, ExecutionType execType, Criteria criteria, IProgressMonitor monitor) {
- super(ITmfEvent.class, range, nbRequested, blockSize, execType);
+ public SearchEventRequest(TmfTimeRange range, int nbRequested, ExecutionType execType, Criteria criteria, IProgressMonitor monitor) {
+ super(ITmfEvent.class, range, 0, nbRequested, execType);
fCriteria = new Criteria(criteria);
fMonitor = monitor;
}
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.trace.location.ITmfLocation;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CaretEvent;
import org.eclipse.swt.custom.CaretListener;
* Extension of the ITimeGraphPresentationProvider interface to avoid API breakage
*
* @author Geneviève Bastien
- * @since 2.1
+ * @since 3.0
* TODO: Add me to ITimeGraphPresentationProvider before the 3.0 release
*/
public interface ITimeGraphPresentationProvider2 extends ITimeGraphPresentationProvider {
* the style of widget to construct
* @param weights
* The relative weights of each side of the sash form
- * @since 2.1
+ * @since 3.0
*/
public TimeGraphCombo(Composite parent, int style, int[] weights) {
super(parent, style);
/**
* Constructor
* @param stateTypeName The state type name
- * @since 2.1
+ * @since 3.0
*/
public TimeGraphPresentationProvider(String stateTypeName) {
fStateTypeName = stateTypeName;
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public ITmfTimeGraphDrawingHelper getDrawingHelper() {
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public void setDrawingHelper(ITmfTimeGraphDrawingHelper helper) {
* The selection begin time
* @param endTime
* The selection end time
- * @since 2.1
+ * @since 3.0
*/
public TimeGraphTimeEvent(Object source, long beginTime, long endTime) {
super(source);
/**
* @return the selection begin time
- * @since 2.1
+ * @since 3.0
*/
public long getBeginTime() {
return fBeginTime;
/**
* @return the selection end time
- * @since 2.1
+ * @since 3.0
*/
public long getEndTime() {
return fEndTime;
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public long getSelectionBegin() {
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public long getSelectionEnd() {
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public void setSelectionRangeNotify(long beginTime, long endTime) {
}
/**
- * @since 2.1
+ * @since 3.0
*/
@Override
public void setSelectionRange(long beginTime, long endTime) {
* The duration of this event
* @param value
* The status assigned to the event
- * @since 2.1
+ * @since 3.0
*/
public TimeEvent(ITimeGraphEntry entry, long time, long duration,
int value) {
* Get this event's status
*
* @return The integer matching this status
- * @since 2.1
+ * @since 3.0
*/
public int getValue() {
return fValue;
* Return whether an event has a value
*
* @return true if the event has a value
- * @since 2.1
+ * @since 3.0
*/
public boolean hasValue() {
return (fValue != NOVALUE);
/**
* An entry for use in the time graph views
*
- * @since 2.1
+ * @since 3.0
*/
public class TimeGraphEntry implements ITimeGraphEntry {
*
* @version 1.0
* @TODO: Move these to the ITimeDateProvider interface when API 3.0 is reached
- * @since 2.1
+ * @since 3.0
*/
public interface ITimeDataProvider2 extends ITimeDataProvider {
* vice-versa functions without having to expose their full functionnalities.
*
* @author gbastien
- * @since 2.1
+ * @since 3.0
*/
public interface ITmfTimeGraphDrawingHelper {
*
* @param statusLineManager
* The status line manager, or null to disable status line messages
- * @since 2.1
+ * @since 3.0
*/
public void setStatusLineManager(IStatusLineManager statusLineManager) {
if (fStatusLineManager != null && statusLineManager == null) {
*
* @param timeGraphScale
* The time graph scale
- * @since 2.1
+ * @since 3.0
*/
public void setTimeGraphScale(TimeGraphScale timeGraphScale) {
fTimeGraphScale = timeGraphScale;
* The begin x-coordinate
* @param end
* The end x-coordinate
- * @since 2.1
+ * @since 3.0
*/
public void setDragRange(int begin, int end) {
if (NO_BUTTON == fDragState || DRAG_EXTERNAL == fDragState) {
* Update the display to use the updated timestamp format
*
* @param signal the incoming signal
- * @since 2.1
+ * @since 3.0
*/
@TmfSignalHandler
public void timestampFormatUpdated(TmfTimestampFormatUpdateSignal signal) {
/**
* Update the time and date formats to use the current time zone
*
- * @since 2.1
+ * @since 3.0
*/
public static void updateTimeZone() {
TimeZone timeZone = TmfTimePreferences.getInstance().getTimeZone();
* recently selected. The array is empty if no items are selected.
* <p>
* @return the array of indices of the selected items
- * @since 2.1
+ * @since 3.0
*/
public int[] getSelectionIndices() {
if (fSelectedEventRank < 0 || fSelectedBeginRank < 0) {
<feature
id="org.eclipse.linuxtools.tmf"
label="%featureName"
- version="2.1.0.qualifier"
+ version="3.0.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.linuxtools.license.feature"
license-feature-version="1.0.0.qualifier">
name="Common Trace Format (CTF)"/>
<requires>
- <import plugin="org.eclipse.linuxtools.ctf.core" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.ctf.core" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui.views"/>
<import plugin="org.eclipse.core.expressions"/>
- <import plugin="org.eclipse.linuxtools.tmf.core" version="2.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.tmf.core" version="3.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.ui.navigator"/>
<parent>
<artifactId>linuxtools-lttng-parent</artifactId>
<groupId>org.eclipse.linuxtools.lttng</groupId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.linuxtools.tmf</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools TMF (Tracing and Monitoring Framework) Feature</name>
<groupId>org.eclipse.linuxtools.lttng</groupId>
<artifactId>linuxtools-lttng-parent</artifactId>
- <version>2.1.0-SNAPSHOT</version>
+ <version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Eclipse Linux Tools LTTng Parent</name>