Search in sources :

Example 6 with EntryCallEvent

use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.

the class SimpleBranchReference method computeBranchTransitions.

/**
 * According to the reference usage model user sessions are created that exactly represent the
 * user behavior of the reference usage model. The entry and exit times enable that the calls
 * within the user sessions are ordered according to the reference usage model The branch
 * transition counter ensures that each branch transition is visited by at least one user
 * session.
 *
 * @param entryCallSequenceModel
 * @param branch
 * @param numberOfBranchTransitions
 *
 * @return list of branch transition counter
 */
private static List<Integer> computeBranchTransitions(final EntryCallSequenceModel entryCallSequenceModel, final Branch branch, final int numberOfBranchTransitions) {
    final List<Integer> branchTransitionCounter = new ArrayList<>();
    boolean areAllBranchesVisited = true;
    do {
        for (int i = 0; i < branch.getBranchTransitions_Branch().size(); i++) {
            branchTransitionCounter.add(i, 0);
        }
        for (int i = 0; i < entryCallSequenceModel.getUserSessions().size(); i++) {
            // Each user sessions represents randomly one of the branch transitions
            final int branchDecisioner = TestHelper.getRandomInteger(numberOfBranchTransitions - 1, 0);
            if (branchDecisioner == 0) {
                SimpleBranchReference.sequenceConstructor(branchTransitionCounter, 0, entryCallSequenceModel, i, 0, 1);
            } else if (branchDecisioner == 1) {
                SimpleBranchReference.sequenceConstructor(branchTransitionCounter, 1, entryCallSequenceModel, i, 1, 0);
            } else if (branchDecisioner == 2) {
                SimpleBranchReference.sequenceConstructor(branchTransitionCounter, 2, entryCallSequenceModel, i, 2, 0);
            } else if (branchDecisioner == 3) {
                SimpleBranchReference.sequenceConstructor(branchTransitionCounter, 3, entryCallSequenceModel, i, 3, 0);
            } else if (branchDecisioner == 4) {
                SimpleBranchReference.sequenceConstructor(branchTransitionCounter, 4, entryCallSequenceModel, i, 4, 0);
            } else {
                throw new IllegalArgumentException("Illegal value of model element parameter");
            }
            final EntryCallEvent entryCallEvent3 = new EntryCallEvent(3, 4, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
            entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent3, true);
        }
        // Checks whether all branch transitions are represented within the user sessions
        for (int i = 0; i < branchTransitionCounter.size(); i++) {
            if (branchTransitionCounter.get(i) == 0) {
                areAllBranchesVisited = false;
                break;
            }
        }
    } while (!areAllBranchesVisited);
    return branchTransitionCounter;
}
Also used : EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) ArrayList(java.util.ArrayList)

Example 7 with EntryCallEvent

use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.

the class BranchModelCreator method setBranchSequence.

/**
 * Sets the passed events as branch sequence of the passed branch. The sequenceStartIndex
 * defines at which position of the passed events the branch sequence starts
 *
 * @param examinedBranch
 *            for that the branchSequence will be set
 * @param events
 *            represent the sequence to set
 * @param sequenceStartIndex
 *            states at which position of the passed events the branch sequence starts
 */
private void setBranchSequence(final Branch examinedBranch, final List<EntryCallEvent> events, final int sequenceStartIndex) {
    final List<ISequenceElement> branchSequence = new ArrayList<>();
    for (int j = sequenceStartIndex; j < events.size(); j++) {
        final EntryCallEvent callEvent = events.get(j);
        final CallElement callElement = new CallElement(callEvent.getClassSignature(), callEvent.getOperationSignature());
        callElement.setAbsoluteCount(1);
        branchSequence.add(callElement);
    }
    final ExitElement exitElement = new ExitElement();
    exitElement.setAbsoluteCount(1);
    branchSequence.add(exitElement);
    examinedBranch.setBranchSequence(branchSequence);
}
Also used : EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) CallElement(org.iobserve.analysis.userbehavior.data.CallElement) ISequenceElement(org.iobserve.analysis.userbehavior.data.ISequenceElement) ArrayList(java.util.ArrayList) ExitElement(org.iobserve.analysis.userbehavior.data.ExitElement)

Example 8 with EntryCallEvent

use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.

the class TBehaviorModelTableGeneration method execute.

@Override
protected void execute(final EntryCallSequenceModel entryCallSequenceModel) {
    final List<UserSession> userSessions = entryCallSequenceModel.getUserSessions();
    for (final UserSession userSession : userSessions) {
        final List<EntryCallEvent> entryCalls = userSession.getEvents();
        EntryCallEvent lastCall = null;
        for (final EntryCallEvent eventCall : entryCalls) {
            if (lastCall != null) {
                this.modelTable.addTransition(lastCall, eventCall);
                this.modelTable.addInformation(eventCall);
            } else {
                /**
                 * only called at first valid event (condition lastCall == null is not needed)
                 */
                this.modelTable.addInformation(eventCall);
            }
            lastCall = eventCall;
        }
    }
}
Also used : EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 9 with EntryCallEvent

use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.

the class TBehaviorModelPreperation method executeEntryCallSequenceModel.

/**
 * Execute case object instanceof EntryCallSequenceModel.
 *
 * @param entryCallSequenceModel
 *            entryCallSequenceModel
 */
private void executeEntryCallSequenceModel(final EntryCallSequenceModel entryCallSequenceModel) {
    if (this.behaviorModelTable == null) {
        this.sequenceModelCache.add(entryCallSequenceModel);
    } else {
        final List<UserSession> userSessions = entryCallSequenceModel.getUserSessions();
        for (final UserSession userSession : userSessions) {
            final BehaviorModelTable modelTable = this.behaviorModelTable.getClearedCopy(this.keepEmptyTransitions);
            final List<EntryCallEvent> entryCalls = userSession.getEvents();
            EntryCallEvent lastCall = null;
            for (final EntryCallEvent eventCall : entryCalls) {
                final boolean isAllowed = modelTable.isAllowedSignature(eventCall);
                if (lastCall != null && isAllowed) {
                    modelTable.addTransition(lastCall, eventCall);
                    modelTable.addInformation(eventCall);
                } else if (isAllowed) {
                    // only called at first valid event
                    // (condition lastCall == null is not needed
                    modelTable.addInformation(eventCall);
                }
                lastCall = isAllowed ? eventCall : lastCall;
            }
            this.outputPort.send(modelTable);
        }
    }
}
Also used : BehaviorModelTable(org.iobserve.analysis.clustering.filter.models.BehaviorModelTable) EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 10 with EntryCallEvent

use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.

the class TraceOperationCleanupFilter method execute.

@Override
protected void execute(final UserSession session) throws Exception {
    for (final EntryCallEvent event : session.getEvents()) {
        event.setClassSignature(this.rewriter.rewriteClassSignature(event.getClassSignature()));
        event.setClassSignature(this.rewriter.rewriteOperationSignature(event.getOperationSignature()));
    }
}
Also used : EntryCallEvent(org.iobserve.stages.general.data.EntryCallEvent)

Aggregations

EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)22 UserSession (org.iobserve.analysis.session.data.UserSession)8 EntryCallSequenceModel (org.iobserve.analysis.data.EntryCallSequenceModel)6 ArrayList (java.util.ArrayList)5 ReferenceElements (org.iobserve.analysis.userbehavior.ReferenceElements)5 Correspondent (org.iobserve.model.correspondence.Correspondent)4 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)4 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)4 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)4 Start (org.palladiosimulator.pcm.usagemodel.Start)4 Stop (org.palladiosimulator.pcm.usagemodel.Stop)4 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)4 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)4 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)3 Loop (org.palladiosimulator.pcm.usagemodel.Loop)3 HashMap (java.util.HashMap)1 List (java.util.List)1 BehaviorModelTable (org.iobserve.analysis.clustering.filter.models.BehaviorModelTable)1 Branch (org.iobserve.analysis.userbehavior.data.Branch)1 BranchModel (org.iobserve.analysis.userbehavior.data.BranchModel)1