use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement in project tracecompass by tracecompass.
the class LttngUstCallStackAnalysisRequirement method getSubRequirements.
private static Collection<TmfAbstractAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) {
Set<@NonNull String> requiredEventsFields = Collections.singleton(layout.contextVtid());
// Requirement for the cyg_profile events
TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFuncEntry(), requiredEventsFields, PriorityLevel.MANDATORY);
TmfAbstractAnalysisRequirement exitReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFuncExit(), requiredEventsFields, PriorityLevel.MANDATORY);
TmfAbstractAnalysisRequirement cygProfile = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
// Requirement for the cyg_profile_fast events
entryReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFastFuncEntry(), requiredEventsFields, PriorityLevel.MANDATORY);
exitReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFastFuncExit(), requiredEventsFields, PriorityLevel.MANDATORY);
TmfAbstractAnalysisRequirement cygProfileFast = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);
return ImmutableSet.of(cygProfile, cygProfileFast);
}
use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement in project tracecompass by tracecompass.
the class AnalysisEventFieldRequirementTest method testMandatoryRequirements.
/**
* Test with mandatory requirements
*/
@Test
public void testMandatoryRequirements() {
/* Test mandatory requirement */
TmfAbstractAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1), PriorityLevel.MANDATORY);
assertTrue(req.test(trace));
req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), PriorityLevel.MANDATORY);
assertTrue(req.test(trace));
/* EVENT3 is not part of the trace. Test case that one of the events is part of the trace */
req = new TmfAnalysisEventFieldRequirement(EVENT3, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), PriorityLevel.MANDATORY);
assertFalse(req.test(trace));
/* EVENT_FIELD is not an event field of the trace */
req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2, EVENT_FIELD), PriorityLevel.MANDATORY);
assertFalse(req.test(trace));
/* Test case that all events need to have the given fields */
req = new TmfAnalysisEventFieldRequirement("", ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), PriorityLevel.MANDATORY);
assertTrue(req.test(trace));
/* Test case that all events need to have the given fields */
req = new TmfAnalysisEventFieldRequirement("", ImmutableSet.of(EVENT2_FIELD1), PriorityLevel.MANDATORY);
assertFalse(req.test(trace));
/* Test case that empty list of event fields behaves like Event Requirements */
req = new TmfAnalysisEventFieldRequirement(EVENT1, checkNotNull(Collections.emptyList()));
assertTrue(req.test(trace));
}
use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement in project tracecompass by tracecompass.
the class AnalysisEventFieldRequirementTest method testAllOrNothingRequirements.
/**
* Test with {@link PriorityLevel#ALL_OR_NOTHING} requirements
*/
@Test
public void testAllOrNothingRequirements() {
/* Test at least one requirement */
TmfAbstractAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1), PriorityLevel.ALL_OR_NOTHING);
assertTrue(req.test(trace));
req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), PriorityLevel.ALL_OR_NOTHING);
assertTrue(req.test(trace));
/* EVENT3 is not part of the trace. Test case that the event is part of the trace */
req = new TmfAnalysisEventFieldRequirement(EVENT3, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), PriorityLevel.ALL_OR_NOTHING);
assertTrue(req.test(trace));
/* EVENT_FIELD is not an event field of the trace */
req = new TmfAnalysisEventFieldRequirement(EVENT1, ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2, EVENT_FIELD), PriorityLevel.ALL_OR_NOTHING);
assertFalse(req.test(trace));
/* Test case that all events need to have either all or none of the given fields */
req = new TmfAnalysisEventFieldRequirement("", ImmutableSet.of(EVENT1_FIELD1, EVENT2_FIELD2), PriorityLevel.ALL_OR_NOTHING);
assertFalse(req.test(trace));
/* Test case that all events need to have the given fields */
req = new TmfAnalysisEventFieldRequirement("", ImmutableSet.of(EVENT1_FIELD1), PriorityLevel.ALL_OR_NOTHING);
assertTrue(req.test(trace));
/* Test case that empty list of event fields behaves like Event Requirements */
req = new TmfAnalysisEventFieldRequirement(EVENT1, checkNotNull(Collections.emptyList()), PriorityLevel.ALL_OR_NOTHING);
assertTrue(req.test(trace));
}
use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement in project tracecompass by tracecompass.
the class AnalysisEventRequirementTest method testAtLeastOneRequirements.
/**
* Test with {@link PriorityLevel#AT_LEAST_ONE} requirements
*/
@Test
public void testAtLeastOneRequirements() {
/* Test mandatory requirement */
TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1), PriorityLevel.AT_LEAST_ONE);
assertTrue(req.test(fTrace));
req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.AT_LEAST_ONE);
assertTrue(req.test(fTrace));
/* Event 3 is not an event of the trace */
req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2, EVENT3), PriorityLevel.AT_LEAST_ONE);
assertTrue(req.test(fTrace));
req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT3), PriorityLevel.AT_LEAST_ONE);
assertFalse(req.test(fTrace));
}
use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement in project tracecompass by tracecompass.
the class AnalysisEventRequirementTest method testNoPreDefinedEvents.
/**
* Test event requirements on a trace with no pre-defined events. They
* should all pass
*/
@Test
public void testNoPreDefinedEvents() {
/* A simple trace with no pre-defined events */
TmfTrace traceNoEvents = new TmfTraceStub();
TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT3), PriorityLevel.MANDATORY);
assertTrue(req.test(traceNoEvents));
req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.OPTIONAL);
assertTrue(req.test(traceNoEvents));
traceNoEvents.dispose();
}
Aggregations