Search in sources :

Example 6 with LamiTableEntry

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

the class LamiReportViewTabPage method updateSelection.

// ------------------------------------------------------------------------
// Signals
// ------------------------------------------------------------------------
// Custom chart signals
/**
 * Signal handler for a chart selection update. It will try to propagate a
 * {@link TmfSelectionRangeUpdatedSignal} if possible.
 *
 * @param signal
 *            The selection update signal
 */
@TmfSignalHandler
public void updateSelection(ChartSelectionUpdateSignal signal) {
    /* Make sure we are not sending a signal to ourself */
    if (signal.getSource() == this) {
        return;
    }
    /* Make sure the signal comes from the data provider's scope */
    if (fResultTable.hashCode() != signal.getDataProvider().hashCode()) {
        return;
    }
    /* Find which index row has been selected */
    Set<Object> entries = signal.getSelectedObject();
    /* Update the selection */
    fSelection = entries;
    /* Only propagate to all TraceCompass if there is a single selection */
    if (entries.size() == 1) {
        LamiTableEntry entry = (LamiTableEntry) Iterables.getOnlyElement(entries);
        /* Make sure the selection represent a time range */
        LamiTimeRange timeRange = entry.getCorrespondingTimeRange();
        if (timeRange == null) {
            return;
        }
        /* Get the timestamps from the time range */
        /**
         * TODO: Consider low and high limits of timestamps here.
         */
        Number tsBeginValueNumber = timeRange.getBegin().getValue();
        Number tsEndValueNumber = timeRange.getEnd().getValue();
        if (tsBeginValueNumber == null || tsEndValueNumber == null) {
            return;
        }
        /* Send Range update to other views */
        ITmfTimestamp start = TmfTimestamp.fromNanos(tsBeginValueNumber.longValue());
        ITmfTimestamp end = TmfTimestamp.fromNanos(tsEndValueNumber.longValue());
        TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, start, end));
    }
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) LamiTimeRange(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 7 with LamiTableEntry

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

the class LamiAspectTest method lamiDurationAspectTest.

/**
 * Test the duration aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiDurationAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiDurationAspect(ASPECT_NAME, 3);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (ns)", 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) LamiDurationAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiDurationAspect) Test(org.junit.Test)

Example 8 with LamiTableEntry

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

the class LamiAspectTest method lamiIRQNameAspectTest.

/**
 * Test the irq name aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiIRQNameAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiIRQNameAspect(ASPECT_NAME, 3);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (name)", aspect.getLabel());
    assertEquals(ASPECT_NAME + " (name)", aspect.getName());
    assertEquals(-1, 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) LamiIRQNameAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNameAspect) LamiTableEntry(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry) Test(org.junit.Test)

Example 9 with LamiTableEntry

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

the class LamiAspectTest method lamiEmptyAspectTest.

/**
 * Test the empty aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiEmptyAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = LamiEmptyAspect.INSTANCE;
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals("", aspect.getLabel());
    assertEquals("", 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) Test(org.junit.Test)

Example 10 with LamiTableEntry

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

the class LamiAspectTest method lamiProcessNameAspectTest.

/**
 * Test the process name aspect
 *
 * @throws JSONException
 *             won't happen
 */
@Test
public void lamiProcessNameAspectTest() throws JSONException {
    LamiTableEntryAspect aspect = new LamiProcessNameAspect(ASPECT_NAME, 0);
    LamiTableEntry entry1 = createLamiData(1);
    LamiTableEntry entry2 = createLamiData(2);
    assertEquals(ASPECT_NAME + " (name)", aspect.getLabel());
    assertEquals(ASPECT_NAME + " (name)", aspect.getName());
    assertEquals(0, aspect.getComparator().compare(entry1, entry2));
    assertNull(aspect.resolveString(entry1));
    assertNull(aspect.resolveNumber(entry1));
}
Also used : LamiProcessNameAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessNameAspect) 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)

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