Search in sources :

Example 16 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class RequestBenchmark method main.

/**
 * Run the benchmark
 *
 * @param args
 *            The command-line arguments
 */
public static void main(final String[] args) {
    try {
        /* Our experiment will contains ONE trace */
        final ITmfTrace[] traces = new ITmfTrace[1];
        traces[0] = new CtfTmfTrace();
        traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
        /* Create our new experiment */
        fExperiment = new TmfExperiment(CtfTmfEvent.class, "Headless", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
        /*
             * We will issue a request for each "pass". TMF will then process
             * them synchronously.
             */
        RequestBenchmark request = null;
        for (int x = 0; x < NB_OF_PASS; x++) {
            request = new RequestBenchmark(CtfTmfEvent.class, TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
            fExperiment.sendRequest(request);
        }
        prev = System.nanoTime();
    } catch (final NullPointerException e) {
    /*
             * Silently dismiss Null pointer exception The only way to "finish"
             * the threads in TMF is by crashing them with null.
             */
    } catch (final Exception e) {
        e.printStackTrace();
    }
}
Also used : CtfTmfEvent(org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)

Example 17 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testExperimentTimestampInTrace.

// ------------------------------------------------------------------------
// Test an experiment
// ------------------------------------------------------------------------
/**
 * Test in an experiment when we select a timestamp that is part of one of
 * the experiment's traces.
 *
 * The experiment's current time should be correctly updated.
 */
@Test
public void testExperimentTimestampInTrace() {
    TmfExperiment exp = createExperiment(trace1, trace2);
    openTrace(exp);
    ITmfTimestamp ts = TmfTimestamp.fromNanos(t1start + ONE_SECOND);
    selectTimestamp(ts);
    /* The experiment's current time should be updated. */
    TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
    assertEquals(ts, selection.getStartTime());
    assertEquals(ts, selection.getEndTime());
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 18 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testExperimentRangeClampingOne.

/**
 * Test the range clamping with the start time of the range outside of the
 * earliest trace's range. Only that start time should get clamped.
 */
@Test
public void testExperimentRangeClampingOne() {
    TmfExperiment exp = createExperiment(trace1, trace2);
    openTrace(exp);
    final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(t1start - ONE_SECOND), TmfTimestamp.fromNanos(t1end - ONE_SECOND));
    selectWindowRange(range);
    TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
    assertEquals(t1start, actualRange.getStartTime().getValue());
    assertEquals(t1end - ONE_SECOND, actualRange.getEndTime().getValue());
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 19 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceManagerTest method testExperimentTimestampInvalid.

/**
 * Test in an experiment when we select a timestamp that is outside of the
 * total range of the experiment.
 *
 * The experiment's current time should not be updated.
 */
@Test
public void testExperimentTimestampInvalid() {
    TmfExperiment exp = createExperiment(trace1, trace2);
    openTrace(exp);
    ITmfTimestamp ts = TmfTimestamp.fromNanos(t2end + ONE_SECOND);
    selectTimestamp(ts);
    /* The experiment's current time should NOT be updated. */
    TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
    assertEquals(trace1.getStartTime(), selection.getStartTime());
    assertEquals(trace1.getStartTime(), selection.getEndTime());
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 20 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceManagerTest method createExperiment.

// ------------------------------------------------------------------------
// Utility methods
// ------------------------------------------------------------------------
@NonNull
private static TmfExperiment createExperiment(ITmfTrace t1, ITmfTrace t2) {
    ITmfTrace[] traces = new ITmfTrace[] { t1, t2 };
    TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "test-exp", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    exp.indexTrace(true);
    // Deregister experiment from signal manager so that it doesn't
    // interfere with the TmfTraceManager tests
    TmfSignalManager.deregister(exp);
    return exp;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) NonNull(org.eclipse.jdt.annotation.NonNull)

Aggregations

TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)55 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)33 Test (org.junit.Test)31 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)11 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)9 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)8 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)7 AnalysisManagerTest (org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest)7 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)7 Nullable (org.eclipse.jdt.annotation.Nullable)5 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)4 NonNull (org.eclipse.jdt.annotation.NonNull)3 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)3 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)3 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)3 ITmfTimestampTransform (org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform)3 SynchronizationAlgorithm (org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm)3 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)3 CtfTmfEvent (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent)3 Before (org.junit.Before)3