Search in sources :

Example 31 with UserSession

use of org.iobserve.analysis.session.data.UserSession 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 32 with UserSession

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

the class UserSessionOperationCleanupStage method execute.

@Override
protected void execute(final UserSession session) throws Exception {
    final UserSession filteredUserSession = new UserSession(session.getHost(), session.getSessionId());
    session.getEvents().stream().filter(this.filter::isAllowed).forEach(filteredUserSession::add);
    this.outputPort.send(filteredUserSession);
}
Also used : UserSession(org.iobserve.analysis.session.data.UserSession)

Example 33 with UserSession

use of org.iobserve.analysis.session.data.UserSession 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 34 with UserSession

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

the class SessionOperationCleanupFilter method filterSession.

private UserSession filterSession(final UserSession session) {
    final UserSession filteredUserSession = new UserSession(session.getHost(), session.getSessionId());
    session.getEvents().stream().filter(this.filter::isAllowed).forEach(filteredUserSession::add);
    return filteredUserSession;
}
Also used : UserSession(org.iobserve.analysis.session.data.UserSession)

Example 35 with UserSession

use of org.iobserve.analysis.session.data.UserSession 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)

Aggregations

UserSession (org.iobserve.analysis.session.data.UserSession)39 EntryCallEvent (org.iobserve.stages.general.data.EntryCallEvent)16 ArrayList (java.util.ArrayList)14 UserSessionCollectionModel (org.iobserve.analysis.data.UserSessionCollectionModel)8 EntryCallSequenceModel (org.iobserve.analysis.data.EntryCallSequenceModel)5 HashMap (java.util.HashMap)3 List (java.util.List)3 PayloadAwareEntryCallEvent (org.iobserve.stages.general.data.PayloadAwareEntryCallEvent)3 Random (java.util.Random)2 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)2 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)2 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)2 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)2 Loop (org.palladiosimulator.pcm.usagemodel.Loop)2 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)2 Start (org.palladiosimulator.pcm.usagemodel.Start)2 Stop (org.palladiosimulator.pcm.usagemodel.Stop)2 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)2 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)2 HashSet (java.util.HashSet)1