Search in sources :

Example 1 with LamiIRQNameAspect

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNameAspect 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 2 with LamiIRQNameAspect

use of org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNameAspect in project tracecompass by tracecompass.

the class LamiAnalysis method getAspectsFromColumnDescriptions.

private static List<LamiTableEntryAspect> getAspectsFromColumnDescriptions(JSONArray columnDescriptions) throws JSONException {
    ImmutableList.Builder<LamiTableEntryAspect> aspectsBuilder = new ImmutableList.Builder<>();
    for (int j = 0; j < columnDescriptions.length(); j++) {
        JSONObject column = columnDescriptions.getJSONObject(j);
        DataType columnDataType;
        String columnClass = column.optString(LamiStrings.CLASS, null);
        if (columnClass == null) {
            columnDataType = DataType.MIXED;
        } else {
            columnDataType = getDataTypeFromString(columnClass);
        }
        String columnTitle = column.optString(LamiStrings.TITLE, null);
        if (columnTitle == null) {
            // $NON-NLS-1$
            columnTitle = String.format("%s #%d", columnDataType.getTitle(), j + 1);
        }
        final int colIndex = j;
        switch(columnDataType) {
            case TIME_RANGE:
                /*
                 * We will add 3 aspects, to represent the start, end and
                 * duration of this time range.
                 */
                aspectsBuilder.add(new LamiTimeRangeBeginAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiTimeRangeEndAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiTimeRangeDurationAspect(columnTitle, colIndex));
                break;
            case TIMESTAMP:
                aspectsBuilder.add(new LamiTimestampAspect(columnTitle, colIndex));
                break;
            case PROCESS:
                aspectsBuilder.add(new LamiProcessNameAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiProcessPIDAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiProcessTIDAspect(columnTitle, colIndex));
                break;
            case IRQ:
                aspectsBuilder.add(new LamiIRQTypeAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiIRQNameAspect(columnTitle, colIndex));
                aspectsBuilder.add(new LamiIRQNumberAspect(columnTitle, colIndex));
                break;
            case DURATION:
                aspectsBuilder.add(new LamiDurationAspect(columnTitle, colIndex));
                break;
            case MIXED:
                aspectsBuilder.add(new LamiMixedAspect(columnTitle, colIndex));
                break;
            // $CASES-OMITTED$
            default:
                String units = column.optString(LamiStrings.UNIT, null);
                if (units == null) {
                    units = columnDataType.getUnits();
                }
                /* We will add only one aspect representing the element */
                LamiTableEntryAspect aspect = new LamiGenericAspect(columnTitle, units, colIndex, columnDataType.isContinuous(), false);
                aspectsBuilder.add(aspect);
                break;
        }
    }
    /*
         * SWT quirk : we need an empty column at the end or else the last data
         * column will clamp to the right edge of the view if it is
         * right-aligned.
         */
    aspectsBuilder.add(LamiEmptyAspect.INSTANCE);
    return aspectsBuilder.build();
}
Also used : LamiProcessNameAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessNameAspect) LamiTableEntryAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect) LamiTimestampAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimestampAspect) ImmutableList(com.google.common.collect.ImmutableList) LamiMixedAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiMixedAspect) LamiGenericAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiGenericAspect) NonNullUtils.nullToEmptyString(org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString) LamiProcessPIDAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessPIDAspect) LamiDurationAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiDurationAspect) LamiTimeRangeDurationAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeDurationAspect) LamiProcessTIDAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessTIDAspect) JSONObject(org.json.JSONObject) LamiIRQNameAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNameAspect) LamiTimeRangeEndAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeEndAspect) DataType(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData.DataType) LamiIRQNumberAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNumberAspect) LamiTimeRangeBeginAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeBeginAspect) LamiIRQTypeAspect(org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQTypeAspect)

Aggregations

LamiIRQNameAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNameAspect)2 LamiTableEntryAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTableEntryAspect)2 ImmutableList (com.google.common.collect.ImmutableList)1 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)1 LamiDurationAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiDurationAspect)1 LamiGenericAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiGenericAspect)1 LamiIRQNumberAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQNumberAspect)1 LamiIRQTypeAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiIRQTypeAspect)1 LamiMixedAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiMixedAspect)1 LamiProcessNameAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessNameAspect)1 LamiProcessPIDAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessPIDAspect)1 LamiProcessTIDAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiProcessTIDAspect)1 LamiTimeRangeBeginAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeBeginAspect)1 LamiTimeRangeDurationAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeDurationAspect)1 LamiTimeRangeEndAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimeRangeEndAspect)1 LamiTimestampAspect (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.aspect.LamiTimestampAspect)1 LamiTableEntry (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiTableEntry)1 DataType (org.eclipse.tracecompass.internal.provisional.analysis.lami.core.types.LamiData.DataType)1 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1