use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TmfTraceManagerTest method testExperimentInitialRange.
/**
* Test the initial range of an experiment.
*/
@Test
public void testExperimentInitialRange() {
TmfExperiment exp = createExperiment(trace1, trace2);
openTrace(exp);
/*
* The initial range should be == to the initial range of the earliest
* trace (here trace1).
*/
final TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
assertEquals(getInitialRange(trace1), actualRange);
assertEquals(getInitialRange(exp), actualRange);
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TmfTraceManagerTest method testTraceSetExperimentForHost.
/**
* Test the contents of a trace set for a host that is part of an experiment
*/
@Test
public void testTraceSetExperimentForHost() {
final ITmfTrace localTrace1 = trace1;
final ITmfTrace localTrace2 = trace2;
assertNotNull(localTrace1);
assertNotNull(localTrace2);
TmfExperiment exp = createExperiment(localTrace1, localTrace2);
openTrace(exp);
selectTrace(exp);
Collection<ITmfTrace> expected = Collections.singleton(trace2);
Collection<ITmfTrace> actual = tm.getTracesForHost(trace2.getHostId());
assertEquals(1, actual.size());
assertEquals(expected, actual);
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TmfTraceManagerTest method testExperimentRangeClampingBoth.
/**
* Test the range clamping when both the start and end times of the signal's
* range are outside of the trace's range. The range should clamp to the
* experiment's range.
*/
@Test
public void testExperimentRangeClampingBoth() {
TmfExperiment exp = createExperiment(trace1, trace2);
openTrace(exp);
final TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(t1start - ONE_SECOND), TmfTimestamp.fromNanos(t2end + ONE_SECOND));
selectWindowRange(range);
TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
assertEquals(t1start, actualRange.getStartTime().getValue());
assertEquals(t2end, actualRange.getEndTime().getValue());
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class XmlDataProviderManagerTest method testExperiment.
/**
* Test getting the XML data provider for an experiment, with an analysis that
* applies to an experiment
*/
@Test
public void testExperiment() {
ITmfTrace trace = null;
ITmfTrace trace2 = null;
ITmfTrace experiment = null;
try {
// Initialize the trace and module
trace = XmlUtilsTest.initializeTrace(TEST_TRACE);
trace2 = XmlUtilsTest.initializeTrace(TEST_TRACE2);
ITmfTrace[] traces = { trace, trace2 };
experiment = new TmfExperiment(ITmfEvent.class, "Xml Experiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, experiment, null);
((TmfTrace) trace).traceOpened(signal);
((TmfTrace) trace2).traceOpened(signal);
((TmfTrace) experiment).traceOpened(signal);
// The data provider manager uses opened traces from the manager
TmfTraceManager.getInstance().traceOpened(signal);
Iterable<@NonNull DataDrivenAnalysisModule> modules = TmfTraceUtils.getAnalysisModulesOfClass(experiment, DataDrivenAnalysisModule.class);
modules.forEach(module -> {
module.schedule();
assertTrue(module.waitForCompletion());
});
// Get the view element from the file
Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.EXPERIMENT.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, EXPERIMENT_VIEW_ID);
assertNotNull(viewElement);
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(experiment, viewElement);
assertNotNull(timeGraphProvider);
assertFalse(timeGraphProvider instanceof TmfTimeGraphCompositeDataProvider);
} finally {
if (trace != null) {
trace.dispose();
}
if (trace2 != null) {
trace2.dispose();
}
if (experiment != null) {
experiment.dispose();
TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, experiment));
}
}
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class SegmentStoreStatisticsDataProviderFactory method createProvider.
@Override
@Nullable
public ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace, String secondaryId) {
IAnalysisModule m = trace.getAnalysisModule(secondaryId);
String composedId = SegmentStoreStatisticsDataProvider.ID + ':' + secondaryId;
// check that this trace has the queried analysis.
if (!(m instanceof ISegmentStoreProvider)) {
if (!(trace instanceof TmfExperiment)) {
return null;
}
return TmfTreeCompositeDataProvider.create(TmfTraceManager.getTraceSet(trace), composedId);
}
m.schedule();
AbstractSegmentStatisticsAnalysis module = new GenericSegmentStatisticsAnalysis(secondaryId);
try {
module.setName(Objects.requireNonNull(NLS.bind(Messages.SegmentStoreStatisticsDataProviderFactory_AnalysisName, m.getName())));
module.setTrace(trace);
} catch (TmfAnalysisException e) {
module.dispose();
return null;
}
module.schedule();
return new SegmentStoreStatisticsDataProvider(trace, module, composedId);
}
Aggregations