Search in sources :

Example 11 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel in project iobserve-analysis by research-iobserve.

the class UserSessionModelAggregator method execute.

@Override
protected void execute() throws Exception {
    final UserSession newUserSession = this.userSessionInputPort.receive();
    if (newUserSession != null) {
        this.userSessions.add(newUserSession);
    }
    final Long timeTrigger = this.timeTriggerInputPort.receive();
    if (timeTrigger != null) {
        // or stream of sessions.
        for (int i = 0; i < this.userSessions.size(); i++) {
            final UserSession userSession = this.userSessions.get(i);
            if (userSession != null) {
                final Long entryTime = userSession.getEntryTime();
                final Long lowerBoundary = timeTrigger - UserSessionModelAggregator.SLIDING_WINDOW;
                if (entryTime < lowerBoundary) {
                    this.userSessions.remove(i);
                }
            }
        }
        final UserSessionCollectionModel model = new UserSessionCollectionModel(this.userSessions);
        this.outputPort.send(model);
    }
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 12 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel in project iobserve-analysis by research-iobserve.

the class BehaviorModelPreparation method execute.

@Override
protected void execute(final Object object) {
    if (object instanceof UserSessionCollectionModel) {
        final UserSessionCollectionModel entryCallSequenceModel = (UserSessionCollectionModel) object;
        this.executeEntryCallSequenceModel(entryCallSequenceModel);
    } else if (object instanceof BehaviorModelTable) {
        final BehaviorModelTable modelTable = (BehaviorModelTable) object;
        this.executeBehaviorModelTable(modelTable);
    } else {
        BehaviorModelPreparation.LOGGER.error("input is nether of type EntryCallSequenceModel nor BehaviorModelTable");
    }
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) BehaviorModelTable(org.iobserve.analysis.behavior.models.data.BehaviorModelTable)

Example 13 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel in project iobserve-analysis by research-iobserve.

the class CollectUserSessionsFilter method execute.

@Override
protected void execute() throws Exception {
    final UserSession userSession = this.userSessionInputPort.receive();
    if (userSession != null) {
        CollectUserSessionsFilter.LOGGER.debug("Received  model...");
        this.userSessions.add(userSession);
    }
    final Long triggerTime = this.timeTriggerInputPort.receive();
    if (triggerTime != null) {
        /**
         * collect all sessions.
         */
        final UserSessionCollectionModel model = new UserSessionCollectionModel(this.userSessions);
        /**
         * remove expired sessions.
         */
        if (this.userSessions.size() > this.minCollectionSize) {
            for (int i = 0; this.userSessions.size() > i; i++) {
                if (this.userSessions.get(i).getExitTime() + this.keepTime < triggerTime) {
                    this.userSessions.remove(i);
                }
            }
        }
        CollectUserSessionsFilter.LOGGER.debug("Sending model...");
        this.outputPort.send(model);
    }
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 14 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel in project iobserve-analysis by research-iobserve.

the class SessionOperationCleanupFilter method execute.

@Override
protected void execute(final UserSessionCollectionModel entryCallSequenceModel) throws Exception {
    final List<UserSession> sessions = entryCallSequenceModel.getUserSessions().stream().map(this::filterSession).collect(Collectors.toList());
    final UserSessionCollectionModel filteredEntryCallSequenceModel = new UserSessionCollectionModel(sessions);
    this.outputPort.send(filteredEntryCallSequenceModel);
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) UserSession(org.iobserve.analysis.session.data.UserSession)

Example 15 with UserSessionCollectionModel

use of org.iobserve.analysis.data.UserSessionCollectionModel in project iobserve-analysis by research-iobserve.

the class BranchExtraction method createCallBranchModels.

/**
 * Create a call branch model.
 */
public void createCallBranchModels() {
    final BranchModelCreator modelCreator = new BranchModelCreator();
    this.branchModels = new ArrayList<>();
    for (final UserSessionCollectionModel entryCallSequenceModel : this.entryCallSequenceModels) {
        /**
         * 1. Aggregates the single EntryCall sequences to a BranchModel
         */
        final BranchModel branchModel = modelCreator.createCallBranchModel(entryCallSequenceModel);
        /**
         * 2. Calculates the likelihoods of the branches of the obtained BranchModel
         */
        modelCreator.calculateLikelihoodsOfBranches(branchModel);
        /**
         * 3. Tries to fuse branches to obtain a more compact model
         */
        modelCreator.compactBranchModel(branchModel);
        this.branchModels.add(branchModel);
    }
}
Also used : UserSessionCollectionModel(org.iobserve.analysis.data.UserSessionCollectionModel) BranchModel(org.iobserve.analysis.behavior.karlsruhe.data.BranchModel)

Aggregations

UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)21 UserSession (org.iobserve.analysis.session.data.UserSession)8 ReferenceElements (org.iobserve.analysis.test.userbehavior.ReferenceElements)8 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)8 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)7 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)7 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)6 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)6 Start (org.palladiosimulator.pcm.usagemodel.Start)6 Stop (org.palladiosimulator.pcm.usagemodel.Stop)6 ArrayList (java.util.ArrayList)5 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)5 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)4 Loop (org.palladiosimulator.pcm.usagemodel.Loop)4 List (java.util.List)3 Repository (org.palladiosimulator.pcm.repository.Repository)3 HashMap (java.util.HashMap)2 Branch (org.palladiosimulator.pcm.usagemodel.Branch)2 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)2