use of org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform in project tracecompass by tracecompass.
the class TimestampTransformBenchmark method testTimestampTransformPerformance.
/**
* Test the timestamp transform performances
*/
@Test
public void testTimestampTransformPerformance() {
ITmfTimestampTransform transform = TimestampTransformFactory.getDefaultTransform();
doTimestampTransformRun("Identity transform", transform, 10);
transform = TimestampTransformFactory.createWithOffset(123456789);
doTimestampTransformRun("Transform with offset", transform, 10);
transform = TimestampTransformFactory.createLinear(Math.PI, 1234);
doTimestampTransformRun("Linear transform", transform, 5);
transform = TimestampTransformFactory.createLinear(10000.1234545565635, -4312278758437L);
doTimestampTransformRun("Linear transform with larger slope and negative offset", transform, 5);
}
use of org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform in project tracecompass by tracecompass.
the class TimeOffsetTest method testPositiveOffset.
@Test
public void testPositiveOffset() throws TmfTraceException {
ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(ONE_MS);
TimestampTransformFactory.setTimestampTransform(fResource, tt);
ITmfTrace trace = createAndIndexTrace();
final TmfContext context = (TmfContext) trace.seekEvent(0);
ITmfEvent event = trace.getNext(context);
assertEquals("Event timestamp", 2, event.getTimestamp().getValue());
event = trace.getNext(context);
assertEquals("Event timestamp", 3, event.getTimestamp().getValue());
trace.dispose();
}
use of org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform in project tracecompass by tracecompass.
the class TimeOffsetTest method testNegativeOffset.
@Test
public void testNegativeOffset() throws TmfTraceException {
ITmfTimestampTransform tt = TimestampTransformFactory.createWithOffset(-ONE_MS);
TimestampTransformFactory.setTimestampTransform(fResource, tt);
ITmfTrace trace = createAndIndexTrace();
final TmfContext context = (TmfContext) trace.seekEvent(0);
ITmfEvent event = trace.getNext(context);
assertEquals("Event timestamp", 0, event.getTimestamp().getValue());
event = trace.getNext(context);
assertEquals("Event timestamp", 1, event.getTimestamp().getValue());
trace.dispose();
}
use of org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform in project tracecompass by tracecompass.
the class TsTransformFactoryTest method transformSlope.
/**
* Test with a slope
*/
@Test
public void transformSlope() {
final ITmfTimestampTransform slope = TimestampTransformFactory.createLinear(10, 0);
final ITmfTimestampTransform slope1 = TimestampTransformFactory.createLinear(10.0, TmfTimestamp.fromNanos(0));
assertEquals(t1e3, slope.transform(t1e2));
assertEquals(tn100, slope.transform(TmfTimestamp.fromNanos(10)));
assertEquals(tn100, slope.transform(slope.transform(tn1)));
assertEquals(tn100, slope.composeWith(slope).transform(tn1));
assertEquals(tn100, slope1.transform(TmfTimestamp.fromNanos(10)));
}
use of org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform in project tracecompass by tracecompass.
the class TsTransformFactoryTest method transformOffset.
/**
* Test with an offset of 100
*/
@Test
public void transformOffset() {
final ITmfTimestampTransform offset = offset1;
final ITmfTimestampTransform compositeTransform = offset.composeWith(TimestampTransformFactory.createWithOffset(TmfTimestamp.fromNanos(-100)));
assertEquals(tn100, offset.transform(t0));
assertEquals(tn100, offset.transform(tn0));
assertEquals(tn0, compositeTransform.transform(tn0));
assertEquals(t0, compositeTransform.transform(t0));
assertEquals(200, offset1.transform(100));
assertEquals(200, offset2.transform(100));
assertEquals(200, offset3.transform(100));
assertEquals(200, offset4.transform(100));
}
Aggregations