use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class CallGraphStatisticsDataProviderFactory method createProvider.
@Override
@Nullable
public ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace) {
if (trace instanceof TmfExperiment) {
return TmfTreeCompositeDataProvider.create(TmfTraceManager.getTraceSet(trace), ID);
}
Iterator<CallStackAnalysis> csModules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class).iterator();
if (!csModules.hasNext()) {
return null;
}
CallStackAnalysis csModule = csModules.next();
csModule.schedule();
ICallGraphProvider cgModule = csModule.getCallGraph();
if (!(cgModule instanceof CallGraphAnalysis)) {
return null;
}
CallGraphStatisticsAnalysis statisticsAnalysis = new CallGraphStatisticsAnalysis();
try {
statisticsAnalysis.setTrace(trace);
} catch (TmfAnalysisException e) {
statisticsAnalysis.dispose();
return null;
}
statisticsAnalysis.schedule();
SegmentStoreStatisticsDataProvider dp = new SegmentStoreStatisticsDataProvider(trace, statisticsAnalysis, CallGraphStatisticsAnalysis.ID);
SymbolFormatter fe = new SymbolFormatter(trace);
dp.setLabelMapper(fe);
return dp;
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class ExperimentSyncTest method testExperimentSync.
/**
* Testing experiment synchronization
*/
@Test
public void testExperimentSync() {
CtfTmfTrace trace1 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.SYNC_SRC);
CtfTmfTrace trace2 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.SYNC_DEST);
ITmfTrace[] traces = { trace1, trace2 };
TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
trace1.setTimestampTransform(tt1);
trace2.setTimestampTransform(tt2);
assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999413783703139011056845831168394, offset = 79796507913179.33347660124688298171 ]", tt1.toString());
assertEquals(TimestampTransformFactory.getDefaultTransform(), tt2);
assertEquals(syncAlgo.getTimestampTransform(trace1.getHostId()), trace1.getTimestampTransform());
assertEquals(syncAlgo.getTimestampTransform(trace2.getHostId()), trace2.getTimestampTransform());
experiment.dispose();
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class XmlDataProviderManager method getTimeGraphProvider.
/**
* Create (if necessary) and get the time graph data provider for the
* specified trace and viewElement.
*
* @param trace
* trace for which we are querying a provider
* @param viewElement
* the XML time graph view element for which we are querying a
* provider
* @return the unique instance of a time graph provider for the queried
* parameters
*/
@Nullable
public synchronized ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> getTimeGraphProvider(ITmfTrace trace, Element viewElement) {
if (!viewElement.hasAttribute(ID_ATTRIBUTE)) {
return null;
}
String viewId = viewElement.getAttribute(ID_ATTRIBUTE);
ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> provider = fTimeGraphProviders.get(trace, viewId);
if (provider != null) {
return provider;
}
if (Iterables.any(TmfTraceManager.getInstance().getOpenedTraces(), opened -> TmfTraceManager.getTraceSetWithExperiment(opened).contains(trace))) {
// Create with the trace or experiment first
TmfXmlTimeGraphViewCu tgViewCu = TmfXmlTimeGraphViewCu.compile(new AnalysisCompilationData(), viewElement);
if (tgViewCu != null) {
DataDrivenTimeGraphProviderFactory timeGraphFactory = tgViewCu.generate();
provider = timeGraphFactory.create(trace);
if (provider == null) {
// composite if that's the case
if (trace instanceof TmfExperiment) {
provider = generateExperimentProviderTimeGraph(TmfTraceManager.getTraceSet(trace), viewElement);
}
}
if (provider != null) {
fTimeGraphProviders.put(trace, viewId, provider);
}
return provider;
}
}
return null;
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TraceAnnotationProvider method init.
private void init(ITmfTrace trace) {
if (trace instanceof TmfExperiment) {
@NonNull Collection<@NonNull ITmfTrace> traces = TmfTraceManager.getTraceSet(trace);
for (ITmfTrace child : traces) {
init(child);
}
return;
}
List<@NonNull IOutputAnnotationProvider> adapters = TmfTraceAdapterManager.getAdapters(trace, IOutputAnnotationProvider.class);
fTraceAnnotations.addAll(adapters);
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TraceAndExperimentTypeTest method testDefaultExperimentType.
/**
* Test whether a newly created experiment has the default experiment type,
* even though none was specified
*/
@Test
public void testDefaultExperimentType() {
TmfExperimentElement experimentElement = ProjectModelTestData.addExperiment(fixture, "testDefaultExpType");
assertNotNull(experimentElement);
TmfExperiment experiment = experimentElement.instantiateTrace();
assertNotNull(experiment);
assertEquals(TmfTraceType.DEFAULT_EXPERIMENT_TYPE, experimentElement.getTraceType());
experiment.dispose();
}
Aggregations