Search in sources :

Example 1 with ILttngUstEventLayout

use of org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout in project tracecompass by tracecompass.

the class LTTngUstCallStackAnalysisRequirementTest method testCallStackRequirements.

/**
 * Test Call Stack Analysis requirements
 */
@Test
public void testCallStackRequirements() {
    ILttngUstEventLayout defaultLayout = ILttngUstEventLayout.DEFAULT_LAYOUT;
    assertNotNull(defaultLayout);
    LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(defaultLayout);
    for (TestData item : TestData.values()) {
        assertEquals(item.name(), item.isValid(), req.test(item.getTrace()));
    }
}
Also used : LttngUstCallStackAnalysisRequirement(org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysisRequirement) ILttngUstEventLayout(org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout) Test(org.junit.Test)

Example 2 with ILttngUstEventLayout

use of org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout in project tracecompass by tracecompass.

the class UstDebugInfoBinaryAspect method resolve.

@Override
@Nullable
public BinaryCallsite resolve(ITmfEvent event) {
    /* This aspect only supports UST traces */
    if (!(event.getTrace() instanceof LttngUstTrace)) {
        return null;
    }
    LttngUstTrace trace = (LttngUstTrace) event.getTrace();
    ILttngUstEventLayout layout = trace.getEventLayout();
    /* We need both the vpid and ip contexts */
    ITmfEventField vpidField = event.getContent().getField(layout.contextVpid());
    ITmfEventField ipField = event.getContent().getField(layout.contextIp());
    if (ipField == null) {
        ipField = event.getContent().getField(layout.fieldAddr());
    }
    if (vpidField == null || ipField == null) {
        return null;
    }
    Long vpid = (Long) vpidField.getValue();
    Long ip = (Long) ipField.getValue();
    long ts = event.getTimestamp().toNanos();
    return getBinaryCallsite(trace, vpid.intValue(), ts, ip.longValue());
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) ITmfEventField(org.eclipse.tracecompass.tmf.core.event.ITmfEventField) ILttngUstEventLayout(org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 3 with ILttngUstEventLayout

use of org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout in project tracecompass by tracecompass.

the class UstMemoryAnalysisModule method getAnalysisRequirements.

@Override
public Iterable<TmfAbstractAnalysisRequirement> getAnalysisRequirements() {
    Set<TmfAbstractAnalysisRequirement> requirements = fAnalysisRequirements;
    if (requirements == null) {
        ITmfTrace trace = getTrace();
        ILttngUstEventLayout layout;
        if (!(trace instanceof LttngUstTrace)) {
            layout = ILttngUstEventLayout.DEFAULT_LAYOUT;
        } else {
            layout = ((LttngUstTrace) trace).getEventLayout();
        }
        @NonNull Set<@NonNull String> requiredEvents = ImmutableSet.of(layout.eventLibcMalloc(), layout.eventLibcFree(), layout.eventLibcCalloc(), layout.eventLibcRealloc(), layout.eventLibcMemalign(), layout.eventLibcPosixMemalign());
        /* Initialize the requirements for the analysis: domain and events */
        TmfAbstractAnalysisRequirement eventsReq = new TmfAnalysisEventRequirement(requiredEvents, PriorityLevel.MANDATORY);
        /*
             * In order to have these events, the libc wrapper with probes should be
             * loaded
             */
        eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingInformation));
        eventsReq.addInformation(nullToEmptyString(Messages.UstMemoryAnalysisModule_EventsLoadingExampleInformation));
        /* The domain type of the analysis */
        // FIXME: The domain requirement should have a way to be verified. It is useless otherwise
        // TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(nullToEmptyString(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN));
        // domainReq.addValue(nullToEmptyString(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST), ValuePriorityLevel.MANDATORY);
        requirements = ImmutableSet.of(eventsReq);
        fAnalysisRequirements = requirements;
    }
    return requirements;
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) NonNull(org.eclipse.jdt.annotation.NonNull) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) NonNullUtils.nullToEmptyString(org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString) ILttngUstEventLayout(org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout)

Example 4 with ILttngUstEventLayout

use of org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout in project tracecompass by tracecompass.

the class LttngUstTrace method initTrace.

@Override
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException {
    super.initTrace(resource, path, eventType);
    /* Determine the event layout to use from the tracer's version */
    ILttngUstEventLayout layout = getLayoutFromEnv();
    fLayout = layout;
    ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder();
    builder.addAll(LTTNG_UST_ASPECTS);
    if (checkFieldPresent(layout.contextVtid())) {
        builder.add(new ContextVtidAspect(layout));
    }
    if (checkFieldPresent(layout.contextVpid())) {
        builder.add(new ContextVpidAspect(layout));
    }
    if (getContainedEventTypes().stream().anyMatch(potentialEvent -> potentialEvent.getName().startsWith(layout.eventTracefPrefix()))) {
        builder.add(UstTracefAspect.getInstance());
    }
    builder.addAll(createCounterAspects(this));
    fUstTraceAspects = builder.build();
}
Also used : ContextVtidAspect(org.eclipse.tracecompass.internal.lttng2.ust.core.trace.ContextVtidAspect) ITmfEventAspect(org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect) ContextVpidAspect(org.eclipse.tracecompass.internal.lttng2.ust.core.trace.ContextVpidAspect) ImmutableSet(com.google.common.collect.ImmutableSet) ILttngUstEventLayout(org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout)

Example 5 with ILttngUstEventLayout

use of org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout in project tracecompass by tracecompass.

the class LttngUstCallStackAnalysis method getAnalysisRequirements.

@Override
@NonNull
public Iterable<@NonNull TmfAbstractAnalysisRequirement> getAnalysisRequirements() {
    Set<@NonNull TmfAbstractAnalysisRequirement> requirements = fAnalysisRequirements;
    if (requirements == null) {
        LttngUstTrace trace = getTrace();
        ILttngUstEventLayout layout = ILttngUstEventLayout.DEFAULT_LAYOUT;
        if (trace != null) {
            layout = trace.getEventLayout();
        }
        requirements = ImmutableSet.of(new LttngUstCallStackAnalysisRequirement(layout));
        fAnalysisRequirements = requirements;
    }
    return requirements;
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) ILttngUstEventLayout(org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout) NonNull(org.eclipse.jdt.annotation.NonNull)

Aggregations

ILttngUstEventLayout (org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout)5 LttngUstTrace (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)3 NonNull (org.eclipse.jdt.annotation.NonNull)2 TmfAbstractAnalysisRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)1 LttngUstCallStackAnalysisRequirement (org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysisRequirement)1 ContextVpidAspect (org.eclipse.tracecompass.internal.lttng2.ust.core.trace.ContextVpidAspect)1 ContextVtidAspect (org.eclipse.tracecompass.internal.lttng2.ust.core.trace.ContextVtidAspect)1 TmfAnalysisEventRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement)1 ITmfEventField (org.eclipse.tracecompass.tmf.core.event.ITmfEventField)1 ITmfEventAspect (org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1 Test (org.junit.Test)1