</excludes>
</fileset>
<fileset><directory>traces/ctf-testsuite</directory></fileset>
+ <fileset><directory>traces/cyg-profile</directory></fileset>
<fileset><directory>traces/hello-lost</directory></fileset>
<fileset><directory>traces/kernel</directory></fileset>
<fileset><directory>traces/kernel_vm</directory></fileset>
+ <fileset><directory>traces/synctraces</directory></fileset>
<fileset><directory>traces/trace2</directory></fileset>
</filesets>
</configuration>
public enum CtfTestTrace {
/** Example kernel trace */
KERNEL("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel"),
+
/** Another kernel trace */
TRACE2("../org.eclipse.linuxtools.ctf.core.tests/traces/trace2"),
+
/** Kernel trace with event contexts */
KERNEL_VM("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm"),
+
/** Trace synchronization: source trace */
SYNC_SRC("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_src"),
+
/** Trace synchronization: destination trace */
SYNC_DEST("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_dest"),
+
/** UST trace with lots of lost events */
- HELLO_LOST("../org.eclipse.linuxtools.ctf.core.tests/traces/hello-lost");
+ HELLO_LOST("../org.eclipse.linuxtools.ctf.core.tests/traces/hello-lost"),
+
+ /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
+ CYG_PROFILE("../org.eclipse.linuxtools.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile"),
+
+ /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
+ CYG_PROFILE_FAST("../org.eclipse.linuxtools.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast");
private final String fPath;
*.tar
*.ht
/ctf-testsuite
+/cyg-profile
/hello-lost
/kernel
/kernel_vm
wget http://www.dorsal.polymtl.ca/~alexmont/data/hello-lost.tar.bz2 -O- | tar xvjf - &&
# CTF test suite, used for testing CTF parser compliance
-git clone https://github.com/efficios/ctf-testsuite.git
+git clone https://github.com/efficios/ctf-testsuite.git &&
# Trace used by the lttng2 kernel to match packets and synchronize
wget http://www.dorsal.polymtl.ca/~gbastien/traces/synctraces.tar.gz -O- | tar xvzf - &&
+# Traces with lttng-ust-cyg-profile (-finstrument-functions) events
+wget http://www.dorsal.polymtl.ca/~alexmont/data/cyg-profile.tar.bz2 -O- | tar xvjf -
+
<get ignoreerrors="true" dest="kernel_vm.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/kernel_vm.tar.bz2" />
<get ignoreerrors="true" dest="synctraces.tar.gz" skipexisting="true" src="http://www.dorsal.polymtl.ca/~gbastien/traces/synctraces.tar.gz" />
<get ignoreerrors="true" dest="hello-lost.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/hello-lost.tar.bz2" />
+ <get ignoreerrors="true" dest="cyg-profile.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/cyg-profile.tar.bz2" />
<exec executable = "git" failifexecutionfails="false">
<arg value = "clone"/>
<arg value = "https://github.com/efficios/ctf-testsuite.git"/>
<available file="kernel_vm.tar.bz2" />
<available file="synctraces.tar.gz" />
<available file="hello-lost.tar.bz2" />
+ <available file="cyg-profile.tar.bz2" />
</and>
</condition>
<antcall target="extractTraces"/>
<bunzip2 src="kernel_vm.tar.bz2" />
<gunzip src="synctraces.tar.gz" />
<bunzip2 src="hello-lost.tar.bz2" />
-
+ <bunzip2 src="cyg-profile.tar.bz2" />
+
<untar src="sample-ctf-trace-20120412.tar" dest="." />
<untar src="trace2.tar" dest="." />
<untar src="kernel_vm.tar" dest="." />
<untar src="synctraces.tar" dest="." />
<untar src="hello-lost.tar" dest="." />
+ <untar src="cyg-profile.tar" dest="." />
<echo message="Traces extracted successfully"/>
</target>
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=error
Bundle-SymbolicName: org.eclipse.linuxtools.lttng2.ust.core.tests;singleton:=true
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit;bundle-version="4.0.0"
-Export-Package: org.eclipse.linuxtools.lttng2.ust.core.tests
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.tmf.core,
+ org.eclipse.linuxtools.tmf.core.tests;bundle-version="3.0.0",
+ org.eclipse.linuxtools.lttng2.ust.core
+Export-Package: org.eclipse.linuxtools.lttng2.ust.core.tests,
+ org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- ActivatorTest.class
+ ActivatorTest.class,
+ org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack.AllTests.class
})
public class AllTests { }
--- /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 implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite for org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ LttngUstCallStackProviderFastTest.class,
+ LttngUstCallStackProviderTest.class
+})
+public class AllTests {
+
+}
--- /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.lttng2.ust.core.tests.trace.callstack;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test suite for the UST callstack state provider, using the trace of a program
+ * instrumented with lttng-ust-cyg-profile-fast.so tracepoints. These do not
+ * contain the function addresses in the func_exit events.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class LttngUstCallStackProviderFastTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.CYG_PROFILE_FAST;
+
+ private static final String PROCNAME = "glxgears-29822";
+
+ private static LttngUstTrace fixture = null;
+
+ // ------------------------------------------------------------------------
+ // Class methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-class initialization.
+ *
+ * @throws TmfTraceException
+ * If the test trace is not found
+ */
+ @BeforeClass
+ public static void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+
+ /* We init the trace ourselves (we need the specific LttngUstTrace type) */
+ fixture = new LttngUstTrace();
+ IStatus valid = fixture.validate(null, testTrace.getPath());
+ assertTrue(valid.isOK());
+ fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+ TestUtils.openTrace(fixture);
+ }
+
+ /**
+ * Perform post-class clean-up.
+ */
+ @AfterClass
+ public static void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(fixture));
+ TestUtils.deleteDirectory(suppDir);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test that the callstack state system is there and contains data.
+ */
+ @Test
+ public void testConstruction() {
+ ITmfStateSystem ss = fixture.getStateSystems().get(TestUtils.SSID);
+ assertNotNull(ss);
+ assertTrue(ss.getNbAttributes() > 0);
+ }
+
+ /**
+ * Test the callstack at the beginning of the state system.
+ */
+ @Test
+ public void testCallStackBegin() {
+ long start = fixture.getStateSystems().get(TestUtils.SSID).getStartTime();
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, start);
+ assertEquals(1, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack1() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250310000000L);
+ assertEquals(2, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x403d60", cs[1]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack2() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250498400000L);
+ assertEquals(3, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x403b14", cs[1]);
+ assertEquals("0x401b23", cs[2]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack3() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250499759000L);
+ assertEquals(4, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x4045c8", cs[1]);
+ assertEquals("0x403760", cs[2]);
+ assertEquals("0x401aac", cs[3]);
+ }
+
+ /**
+ * Test the callstack at the end of the trace/state system.
+ */
+ @Test
+ public void testCallStackEnd() {
+ long end = fixture.getStateSystems().get(TestUtils.SSID).getCurrentEndTime();
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, end);
+ assertEquals(3, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x4045c8", cs[1]);
+ assertEquals("0x403760", cs[2]);
+ }
+}
--- /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.lttng2.ust.core.tests.trace.callstack;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test suite for the UST callstack state provider, using the trace of a program
+ * instrumented with lttng-ust-cyg-profile.so tracepoints.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class LttngUstCallStackProviderTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.CYG_PROFILE;
+ private static final CtfTmfTestTrace otherUstTrace = CtfTmfTestTrace.HELLO_LOST;
+
+ private static final String PROCNAME = "glxgears-16073";
+
+ private static LttngUstTrace fixture = null;
+
+ // ------------------------------------------------------------------------
+ // Class methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-class initialization.
+ *
+ * @throws TmfTraceException
+ * If the test trace is not found
+ */
+ @BeforeClass
+ public static void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+
+ /* We init the trace ourselves (we need the specific LttngUstTrace type) */
+ fixture = new LttngUstTrace();
+ IStatus valid = fixture.validate(null, testTrace.getPath());
+ assertTrue(valid.isOK());
+ fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+ TestUtils.openTrace(fixture);
+ }
+
+ /**
+ * Perform post-class clean-up.
+ */
+ @AfterClass
+ public static void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(fixture));
+ TestUtils.deleteDirectory(suppDir);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test the handling of generic UST traces who do not contain the required
+ * information.
+ */
+ @Test
+ public void testOtherUstTrace() {
+ /* Initialize the trace */
+ final LttngUstTrace ustTrace = new LttngUstTrace();
+ IStatus valid = ustTrace.validate(null, otherUstTrace.getPath());
+ assertTrue(valid.isOK());
+ try {
+ ustTrace.initTrace((IResource) null, otherUstTrace.getPath(), CtfTmfEvent.class);
+ } catch (TmfTraceException e) {
+ fail(e.getMessage());
+ }
+ TestUtils.openTrace(ustTrace);
+
+ /* Make sure the generated state system exists, but is empty */
+ ITmfStateSystem ss = ustTrace.getStateSystems().get(TestUtils.SSID);
+ assertNotNull(ss);
+ assertTrue(ss.getStartTime() >= ustTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue());
+ assertEquals(0, ss.getNbAttributes());
+
+ /* Dispose the trace */
+ ustTrace.dispose();
+ File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(ustTrace));
+ TestUtils.deleteDirectory(suppDir);
+ assertFalse(suppDir.exists());
+ }
+
+ /**
+ * Test that the callstack state system is there and contains data.
+ */
+ @Test
+ public void testConstruction() {
+ ITmfStateSystem ss = fixture.getStateSystems().get(TestUtils.SSID);
+ assertNotNull(ss);
+ assertTrue(ss.getNbAttributes() > 0);
+ }
+
+ /**
+ * Test the callstack at the beginning of the state system.
+ */
+ @Test
+ public void testCallStackBegin() {
+ long start = fixture.getStateSystems().get(TestUtils.SSID).getStartTime();
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, start);
+ assertEquals(1, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack1() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1378850463600000000L);
+ assertEquals(2, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x403d60", cs[1]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack2() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1378850463770000000L);
+ assertEquals(3, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x403b14", cs[1]);
+ assertEquals("0x401b23", cs[2]);
+ }
+
+ /**
+ * Test the callstack somewhere in the trace.
+ */
+ @Test
+ public void testCallStack3() {
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1378850463868753000L);
+ assertEquals(4, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x4045c8", cs[1]);
+ assertEquals("0x403760", cs[2]);
+ assertEquals("0x401aac", cs[3]);
+ }
+
+ /**
+ * Test the callstack at the end of the trace/state system.
+ */
+ @Test
+ public void testCallStackEnd() {
+ long end = fixture.getStateSystems().get(TestUtils.SSID).getCurrentEndTime();
+ String[] cs = TestUtils.getCallStack(fixture, PROCNAME, end);
+ assertEquals(3, cs.length);
+
+ assertEquals("0x40472b", cs[0]);
+ assertEquals("0x4045c8", cs[1]);
+ assertEquals("0x403760", cs[2]);
+ }
+}
--- /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 implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.linuxtools.tmf.core.callstack.CallStackStateProvider;
+import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
+import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
+import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
+import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager;
+import org.eclipse.linuxtools.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
+import org.eclipse.linuxtools.tmf.core.statevalue.ITmfStateValue;
+
+/**
+ * Common methods for LTTng-UST callstack trace tests.
+ *
+ * @author Alexandre Montplaisir
+ */
+final class TestUtils {
+
+ private TestUtils() {}
+
+ /** ID of the generated state systems */
+ static final String SSID = CallStackStateProvider.ID;
+
+ /** Empty and delete a directory */
+ static void deleteDirectory(File dir) {
+ /* Assuming the dir only contains file or empty directories */
+ for (File file : dir.listFiles()) {
+ file.delete();
+ }
+ dir.delete();
+ }
+
+ /** Simulate a trace being opened (which triggers building the state system) */
+ static void openTrace(LttngUstTrace trace) {
+ trace.indexTrace(true);
+ TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(trace, trace, null));
+ trace.getStateSystems().get(SSID).waitUntilBuilt();
+ }
+
+ /** Get the callstack for the given timestamp, for this particular trace */
+ static String[] getCallStack(LttngUstTrace trace, String processName, long timestamp) {
+ try {
+ ITmfStateSystem ss = trace.getStateSystems().get(SSID);
+ int stackAttribute = ss.getQuarkAbsolute("Threads", processName, "CallStack");
+ List<ITmfStateInterval> state = ss.queryFullState(timestamp);
+ int depth = state.get(stackAttribute).getStateValue().unboxInt();
+
+ int stackTop = ss.getQuarkRelative(stackAttribute, String.valueOf(depth));
+ ITmfStateValue top = state.get(stackTop).getStateValue();
+ assertEquals(top, ss.querySingleStackTop(timestamp, stackAttribute).getStateValue());
+
+ String[] ret = new String[depth];
+ for (int i = 0; i < depth; i++) {
+ int quark = ss.getQuarkRelative(stackAttribute, String.valueOf(i + 1));
+ ret[i] = state.get(quark).getStateValue().unboxStr();
+ }
+ return ret;
+
+ } catch (AttributeNotFoundException e) {
+ fail(e.getMessage());
+ } catch (TimeRangeException e) {
+ fail(e.getMessage());
+ } catch (StateSystemDisposedException e) {
+ fail(e.getMessage());
+ } catch (StateValueTypeException e) {
+ fail(e.getMessage());
+ }
+ fail();
+ return null;
+ }
+
+}
/** Trace synchronization: destination trace */
SYNC_DEST,
/** UST trace with lots of lost events */
- HELLO_LOST;
+ HELLO_LOST,
+ /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
+ CYG_PROFILE,
+ /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
+ CYG_PROFILE_FAST;
private final String fPath;
}
/**
- * Get a temporary directory based on a trace's name
+ * Get a temporary directory based on a trace's name. We will create the
+ * directory if it doesn't exist, so that it's ready to be used.
*/
private static String getTemporaryDir(ITmfTrace trace) {
- return System.getProperty("java.io.tmpdir") + //$NON-NLS-1$
+ String pathName = System.getProperty("java.io.tmpdir") + //$NON-NLS-1$
File.separator +
trace.getName() +
File.separator;
+ File dir = new File(pathName);
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ return pathName;
}
}