use of org.eclipse.tracecompass.segmentstore.core.BasicSegment in project tracecompass by tracecompass.
the class SegmentAspectTest method aspectResolveTest.
/**
* Tests the resolve method
*/
@Test
public void aspectResolveTest() {
long start = 1;
long end = 3;
BasicSegment segment = new BasicSegment(start, end);
assertEquals((long) 0, ASPECT_STUB.resolve(segment));
assertEquals(start, START_ASPECT.resolve(segment));
assertEquals(end, END_ASPECT.resolve(segment));
assertEquals(end - start, DURATION_ASPECT.resolve(segment));
}
use of org.eclipse.tracecompass.segmentstore.core.BasicSegment in project tracecompass by tracecompass.
the class SegmentTableTest method onDiskSegStoreTest.
/**
* Test table with an on-disk segment store that is lazy loaded in the table
*
* @throws IOException
* when creating the segment store
*/
@Test
public void onDiskSegStoreTest() throws IOException {
Path segmentFile = Files.createTempFile("tmpSegStore", ".tmp");
assertNotNull(segmentFile);
ISegmentStore<@NonNull BasicSegment> fixture = null;
try {
final int size = 1000000;
fixture = SegmentStoreFactory.createOnDiskSegmentStore(segmentFile, BasicSegment.BASIC_SEGMENT_READ_FACTORY, 1);
for (int i = 0; i < size; i++) {
fixture.add(new BasicSegment(i, 2 * i));
}
fixture.close(false);
assertNotNull(getTable());
getTable().updateModel(fixture);
SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable());
fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
tableBot.header("Duration").click();
fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
tableBot.header("Duration").click();
fBot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2));
} finally {
if (fixture != null) {
fixture.close(true);
}
Files.deleteIfExists(segmentFile);
}
}
use of org.eclipse.tracecompass.segmentstore.core.BasicSegment in project tracecompass by tracecompass.
the class SegmentStoreBenchmark method assertOrder.
private static void assertOrder(ISegmentStore<@NonNull BasicSegment> store, Comparator<@NonNull ISegment> order) {
Iterable<@NonNull BasicSegment> iterable = store.iterator(order);
BasicSegment prev = null;
long count = 0L;
for (BasicSegment segment : iterable) {
if (prev != null) {
assertTrue("Incorrect iteration order at: " + count + ", prev: " + prev + ", current: " + segment, order.compare(prev, segment) <= 0);
}
prev = segment;
count++;
}
}
use of org.eclipse.tracecompass.segmentstore.core.BasicSegment in project tracecompass by tracecompass.
the class SegmentStoreBenchmark method populate.
private static void populate(int size, int[] fuzz, ISegmentStore<@NonNull BasicSegment> store, long low, long high) {
for (long i = low; i < high; i++) {
long start = i + fuzz[(int) (i % size)];
store.add(new BasicSegment(start, start + 10));
}
}
use of org.eclipse.tracecompass.segmentstore.core.BasicSegment in project tracecompass by tracecompass.
the class AbstractTestSegmentStore method testContains.
/**
* Test the contains() method.
*/
@Test
public void testContains() {
ISegment otherSegment = new BasicSegment(0, 20);
assertTrue(fSegmentStore.contains(SEGMENT_2_6));
assertTrue(fSegmentStore.contains(SEGMENT_4_8));
assertFalse(fSegmentStore.contains(otherSegment));
}
Aggregations