Search in sources :

Example 1 with LamiTableEntry

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.

the class LamiJsonParserTest method testResults.

/**
 * Test the results parsing.
 *
 * @throws CoreException when execute() fails.
 */
@Test
public void testResults() throws CoreException {
    LamiAnalysisStub analysis = new LamiAnalysisStub("Stub analysis", "test-metadata.json", "test-results.json");
    LamiTmfTraceStub trace = fTrace;
    assertNotNull(trace);
    List<LamiResultTable> resultTables = analysis.execute(trace, null, "", new NullProgressMonitor());
    assertFalse(resultTables.isEmpty());
    assertEquals(4, resultTables.size());
    LamiResultTable perProcessTable = resultTables.get(0);
    LamiResultTable perSyscallTable = resultTables.get(1);
    LamiResultTable perInterruptTable = resultTables.get(2);
    LamiResultTable perInterruptOverrideTable = resultTables.get(3);
    assertEquals("Per-process stuff", perProcessTable.getTableClass().getTableTitle());
    assertEquals("per-proc", perProcessTable.getTableClass().getTableClassName());
    assertEquals("Per-syscall stuff", perSyscallTable.getTableClass().getTableTitle());
    assertEquals("per-syscall", perSyscallTable.getTableClass().getTableClassName());
    assertEquals("Per-interrupt stuff", perInterruptTable.getTableClass().getTableTitle());
    assertEquals("per-irq", perInterruptTable.getTableClass().getTableClassName());
    assertEquals("Per-interrupt stuff [with overridden title]", perInterruptOverrideTable.getTableClass().getTableTitle());
    assertEquals("Extended per-irq", perInterruptOverrideTable.getTableClass().getTableClassName());
    LamiTimeRange expectedTimeRange = new LamiTimeRange(new LamiTimestamp(1000), new LamiTimestamp(2000));
    assertEquals(expectedTimeRange, perProcessTable.getTimeRange());
    List<LamiTableEntry> syscallEntries = perSyscallTable.getEntries();
    assertFalse(syscallEntries.isEmpty());
    assertEquals(5, syscallEntries.size());
    LamiTableEntry readEntry = syscallEntries.get(0);
    LamiTimeRange readEntryTimeRange = readEntry.getCorrespondingTimeRange();
    expectedTimeRange = new LamiTimeRange(new LamiTimestamp(98233), new LamiTimestamp(1293828));
    assertNotNull(readEntryTimeRange);
    assertEquals(expectedTimeRange, readEntryTimeRange);
    /* Test raw values */
    LamiData value0 = readEntry.getValue(0);
    assertTrue(value0 instanceof LamiSystemCall);
    assertEquals("read", ((LamiSystemCall) value0).getValue());
    LamiData value1 = readEntry.getValue(1);
    assertTrue(value1 instanceof LamiDuration);
    assertEquals(new LamiDuration(2398123), value1);
    LamiData value2 = readEntry.getValue(2);
    assertTrue(value2 instanceof LamiSize);
    assertEquals(new LamiSize(8123982), value2);
    LamiData value3 = readEntry.getValue(3);
    assertTrue(value3 instanceof LamiBitrate);
    assertEquals(new LamiBitrate(223232), value3);
    LamiData value4 = readEntry.getValue(4);
    expectedTimeRange = new LamiTimeRange(new LamiTimestamp(98233), new LamiTimestamp(1293828));
    assertTrue(value4 instanceof LamiTimeRange);
    assertEquals(expectedTimeRange, value4);
    /* Test with aspects */
    Map<String, LamiTableClass> tableModels = analysis.getTableClasses();
    assertNotNull(tableModels);
    LamiTableClass perSyscallClass = tableModels.get("per-syscall");
    assertNotNull(perSyscallClass);
    List<LamiTableEntryAspect> aspects = perSyscallClass.getAspects();
    assertEquals("read()", aspects.get(0).resolveString(readEntry));
    assertEquals(2398123.0, checkNotNull(aspects.get(1).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertEquals(8123982.0, checkNotNull(aspects.get(2).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertEquals(223232.0, checkNotNull(aspects.get(3).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertEquals(98233.0, checkNotNull(aspects.get(4).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertEquals(1293828.0, checkNotNull(aspects.get(5).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertEquals(1195595.0, checkNotNull(aspects.get(6).resolveNumber(readEntry)).doubleValue(), DELTA);
    assertNull(aspects.get(7).resolveString(readEntry));
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiData(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData) LamiAnalysisStub(org.eclipse.tracecompass.analysis.lami.core.tests.shared.analysis.LamiAnalysisStub) LamiTimeRange(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange) LamiBitrate(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiBitrate) LamiTimestamp(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimestamp) LamiResultTable(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiResultTable) LamiSize(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiSize) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) LamiSystemCall(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiSystemCall) LamiTableClass(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableClass) LamiDuration(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiDuration) Test(org.junit.Test)

Example 2 with LamiTableEntry

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.

the class LamiAspectTest method lamiGenericAspectTest.

/**
 * Test the generic aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiGenericAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiGenericAspect(ASPECT_NAME, "gigaTeacups", 3, true, false);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (gigaTeacups)", aspect.getLabel());
    assertEquals(ASPECT_NAME, aspect.getName());
    assertEquals(-1, aspect.getComparator().compare(entry1, entry2));
    assertEquals("1", aspect.resolveString(entry1));
    assertEquals(1.0, aspect.resolveNumber(entry1));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) LamiGenericAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiGenericAspect) Test(org.junit.Test)

Example 3 with LamiTableEntry

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.

the class LamiAspectTest method lamiProcessTIDAspectTest.

/**
 * Test the process tid aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiProcessTIDAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiProcessTIDAspect(ASPECT_NAME, 0);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (TID)", aspect.getLabel());
    assertEquals(ASPECT_NAME + " (TID)", aspect.getName());
    assertEquals(0, aspect.getComparator().compare(entry1, entry2));
    assertNull(aspect.resolveString(entry1));
    assertNull(aspect.resolveNumber(entry1));
}
Also used : LamiProcessTIDAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessTIDAspect) LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) Test(org.junit.Test)

Example 4 with LamiTableEntry

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.

the class LamiAspectTest method lamiIRQNumberAspectTest.

/**
 * Test the irq number aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiIRQNumberAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiIRQNumberAspect(ASPECT_NAME, 3);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (#)", aspect.getLabel());
    assertEquals(ASPECT_NAME + " (#)", aspect.getName());
    assertEquals(0, aspect.getComparator().compare(entry1, entry2));
    assertEquals("1", aspect.resolveString(entry1));
    assertNull(aspect.resolveNumber(entry1));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) LamiIRQNumberAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNumberAspect) Test(org.junit.Test)

Example 5 with LamiTableEntry

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry in project tracecompass by tracecompass.

the class LamiAspectTest method lamiProcessPIDAspectTest.

/**
 * Test the process pid aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiProcessPIDAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiProcessPIDAspect(ASPECT_NAME, 0);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (PID)", aspect.getLabel());
    assertEquals(ASPECT_NAME + " (PID)", aspect.getName());
    assertEquals(0, aspect.getComparator().compare(entry1, entry2));
    assertNull(aspect.resolveString(entry1));
    assertNull(aspect.resolveNumber(entry1));
}
Also used : LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) LamiProcessPIDAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessPIDAspect) Test(org.junit.Test)

Aggregations

LamiTableEntry (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry)21 LamiTableEntryAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect)15 Test (org.junit.Test)15 TableViewer (org.eclipse.jface.viewers.TableViewer)3 HashSet (java.util.HashSet)2 Nullable (org.eclipse.jdt.annotation.Nullable)2 LamiResultTable (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiResultTable)2 LamiData (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData)2 LamiTimeRange (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange)2 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Set (java.util.Set)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SWT (org.eclipse.swt.SWT)1