use of org.eclipse.tracecompass.tmf.core.trace.ITmfTrace in project tracecompass by tracecompass.
the class DistributedCriticalPathTest method testNetworkExchangeWithWifi.
/**
* Test the graph building of a network exchange where one machine receives
* in a softirq and the other receives in a threaded IRQ, with new network
* reception events. The 2 traces include events to wrap IRQ and packet
* reception contexts
*
* @throws TmfTraceException
* Exception thrown by opening experiment
* @throws TmfAnalysisException
* Exception thrown by analyses
*/
@Test
public void testNetworkExchangeWithWifi() throws TmfTraceException, TmfAnalysisException {
ITmfTrace experiment = setUpExperiment("testfiles/graph/network_exchange_eth.xml", "testfiles/graph/network_exchange_wifi.xml");
assertNotNull(experiment);
try {
internalTestNetworkExchangeWithWifi(experiment);
} finally {
experiment.dispose();
}
}
use of org.eclipse.tracecompass.tmf.core.trace.ITmfTrace in project tracecompass by tracecompass.
the class LttngExecutionGraphTest method testSchedEvents.
/**
* Test the graph building with sched events only
*
* TODO: Add wakeup events to this test case
*/
@Test
public void testSchedEvents() {
ITmfTrace trace = setUpTrace("testfiles/graph/sched_only.xml");
assertNotNull(trace);
TmfGraphBuilderModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfGraphBuilderModule.class, TEST_ANALYSIS_ID);
assertNotNull(module);
module.schedule();
assertTrue(module.waitForCompletion());
TmfGraph graph = module.getGraph();
assertNotNull(graph);
Set<IGraphWorker> workers = graph.getWorkers();
assertEquals(2, workers.size());
for (IGraphWorker worker : workers) {
assertTrue(worker instanceof OsWorker);
OsWorker lttngWorker = (OsWorker) worker;
switch(lttngWorker.getHostThread().getTid()) {
case 1:
{
List<TmfVertex> nodesOf = graph.getNodesOf(lttngWorker);
assertEquals(4, nodesOf.size());
/* Check first vertice has outgoing edge preempted */
TmfVertex v = nodesOf.get(0);
assertEquals(10, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
TmfEdge edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.PREEMPTED, edge.getType());
v = nodesOf.get(1);
assertEquals(v, edge.getVertexTo());
/* Check second vertice has outgoing edge running */
assertEquals(20, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.RUNNING, edge.getType());
v = nodesOf.get(2);
assertEquals(v, edge.getVertexTo());
/* Check third vertice has outgoing edge preempted */
assertEquals(30, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.PREEMPTED, edge.getType());
v = nodesOf.get(3);
assertEquals(v, edge.getVertexTo());
/* Check 4th vertice */
assertEquals(40, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE));
}
break;
case 2:
{
List<TmfVertex> nodesOf = graph.getNodesOf(lttngWorker);
assertEquals(4, nodesOf.size());
/* Check first vertice has outgoing edge preempted */
TmfVertex v = nodesOf.get(0);
assertEquals(10, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
TmfEdge edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.RUNNING, edge.getType());
v = nodesOf.get(1);
assertEquals(v, edge.getVertexTo());
/* Check second vertice has outgoing edge running */
assertEquals(20, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.BLOCKED, edge.getType());
v = nodesOf.get(2);
assertEquals(v, edge.getVertexTo());
/* Check third vertice has outgoing edge preempted */
assertEquals(30, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
edge = v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE);
assertNotNull(edge);
assertEquals(EdgeType.RUNNING, edge.getType());
v = nodesOf.get(3);
assertEquals(v, edge.getVertexTo());
/* Check 4th vertice */
assertEquals(40, v.getTs());
assertNull(v.getEdge(EdgeDirection.INCOMING_VERTICAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_VERTICAL_EDGE));
assertNotNull(v.getEdge(EdgeDirection.INCOMING_HORIZONTAL_EDGE));
assertNull(v.getEdge(EdgeDirection.OUTGOING_HORIZONTAL_EDGE));
}
break;
default:
fail("Unknown worker");
break;
}
}
trace.dispose();
}
use of org.eclipse.tracecompass.tmf.core.trace.ITmfTrace in project tracecompass by tracecompass.
the class ExperimentSyncTest method testDjangoExperimentSync.
/**
* Testing synchronization with 3 traces, one of which synchronizes with
* both other
*/
@Test
public void testDjangoExperimentSync() {
CtfTmfTrace trace1 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_CLIENT);
CtfTmfTrace trace2 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_DB);
CtfTmfTrace trace3 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.DJANGO_HTTPD);
ITmfTrace[] traces = { trace1, trace2, trace3 };
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);
ITmfTimestampTransform tt3 = syncAlgo.getTimestampTransform(trace3);
trace1.setTimestampTransform(tt1);
trace2.setTimestampTransform(tt2);
trace3.setTimestampTransform(tt3);
assertEquals(TimestampTransformFactory.getDefaultTransform(), tt1);
assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999996313017589597204633828681240, offset = 498490309972.0038068817738527724192 ]", tt2.toString());
assertEquals("TmfTimestampTransformLinearFast [ slope = 1.000000119014882262265342419815932, offset = -166652893534.6189900382736187431134 ]", tt3.toString());
experiment.dispose();
}
use of org.eclipse.tracecompass.tmf.core.trace.ITmfTrace in project tracecompass by tracecompass.
the class UstKernelSyncTest method setup.
/**
* Test setup
*/
@Before
public void setup() {
ITmfTrace ustTrace = CtfTmfTestTraceUtils.getTrace(UST_TRACE);
ITmfTrace kernelTrace = LttngKernelTestTraceUtils.getTrace(KERNEL_TRACE);
TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "test-exp", new ITmfTrace[] { ustTrace, kernelTrace }, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
/* Simulate experiment being opened */
TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, experiment, null));
TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, experiment));
KernelAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(experiment, KernelAnalysisModule.class, KernelAnalysisModule.ID);
assertNotNull(module);
module.waitForCompletion();
fExperiment = experiment;
fUstTrace = ustTrace;
fKernelModule = module;
}
use of org.eclipse.tracecompass.tmf.core.trace.ITmfTrace in project tracecompass by tracecompass.
the class UstKernelSyncTest method testWholeUstTrace.
/**
* Test going through the whole UST trace, making sure the VTID context of
* each event corresponds to the TID given by the kernel analysis at the
* same timestamp.
*/
@Test
public void testWholeUstTrace() {
TmfExperiment experiment = fExperiment;
ITmfTrace ustTrace = fUstTrace;
KernelAnalysisModule module = fKernelModule;
assertNotNull(experiment);
assertNotNull(ustTrace);
assertNotNull(module);
ITmfContext context = ustTrace.seekEvent(0L);
CtfTmfEvent ustEvent = (CtfTmfEvent) ustTrace.getNext(context);
int count = 0;
while (ustEvent != null) {
Long ustVtid = ustEvent.getContent().getFieldValue(Long.class, "context._vtid");
/* All events in the trace should have that context */
assertNotNull(ustVtid);
long ts = ustEvent.getTimestamp().toNanos();
long cpu = ustEvent.getCPU();
Integer kernelTid = KernelThreadInformationProvider.getThreadOnCpu(module, cpu, ts);
assertNotNull(kernelTid);
assertEquals("Wrong TID for trace event " + ustEvent.toString(), ustVtid.longValue(), kernelTid.longValue());
ustEvent = (CtfTmfEvent) ustTrace.getNext(context);
count++;
}
/* Make sure we've read all expected events */
assertEquals(UST_TRACE.getNbEvents(), count);
}
Aggregations