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();
}
}
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());
}
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());
}
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());
}
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;
}
Aggregations