use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.
the class BranchWithinLoopReference method getModel.
/**
* It creates a reference usage model that contains branches within loops. Accordingly, user
* sessions whose call sequences differ from each other are iterated in a row. Thereby, at each
* iteration of a branched call sequences the probabilities have to be equal because otherwise
* it would not be an iteration (RQ-1.8)
*
* @param referenceUsageModelFileName
* reference usage model file name
* @param repositoryLookupModel
* repository model builder
* @param correspondenceModel
* correspondence model
*
* @return reference usage model and corresponding user sessions
* @throws IOException
* on error
*/
public static ReferenceElements getModel(final String referenceUsageModelFileName, final RepositoryLookupModelProvider repositoryLookupModel, final ICorrespondence correspondenceModel) throws IOException {
// The number of model element parameters are created randomly. The number of user sessions
// must be created accordingly to the number of branch transitions, because it must be
// ensured that at each iteration of an branch the branch transition probabilities are
// equal. This can be achieved by the same number of user sessions representing the branch
// transition at each iteration
final int numberOfLoops = TestHelper.getRandomInteger(3, 3);
final int numberOfConcurrentUsers = (int) Math.pow(2, numberOfLoops) * 5;
final EntryCallSequenceModel entryCallSequenceModel = new EntryCallSequenceModel(TestHelper.getUserSessions(numberOfConcurrentUsers));
final ReferenceElements testElements = new ReferenceElements();
// In the following the reference usage model is created
final UsageModel usageModel = UsageModelFactory.createUsageModel();
final UsageScenario usageScenario = UsageModelFactory.createUsageScenario("", usageModel);
final ScenarioBehaviour scenarioBehaviour = usageScenario.getScenarioBehaviour_UsageScenario();
final Start start = UsageModelFactory.createAddStartAction("", scenarioBehaviour);
final Stop stop = UsageModelFactory.createAddStopAction("", scenarioBehaviour);
final AbstractUserAction lastAction = start;
// The loop element is created that contains the iterated branch
final Loop loop = UsageModelFactory.createLoop("", scenarioBehaviour);
final ScenarioBehaviour loopScenarioBehaviour = loop.getBodyBehaviour_Loop();
UsageModelFactory.connect(lastAction, loop);
final PCMRandomVariable pcmLoopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
pcmLoopIteration.setSpecification(String.valueOf(numberOfLoops));
// Set number of loops
loop.setLoopIteration_Loop(pcmLoopIteration);
UsageModelFactory.connect(loop, stop);
final Start loopStart = UsageModelFactory.createAddStartAction("", loopScenarioBehaviour);
final Stop loopStop = UsageModelFactory.createAddStopAction("", loopScenarioBehaviour);
// The branch that is contained within the loop element is created
final org.palladiosimulator.pcm.usagemodel.Branch branch = UsageModelFactory.createBranch("", loopScenarioBehaviour);
UsageModelFactory.connect(loopStart, branch);
// The branch transition 1 is created
final BranchTransition branchTransition1 = BranchWithinLoopReference.createBranchTransition(2, repositoryLookupModel, branch, correspondenceModel);
// The branch transition 2 is created
final BranchTransition branchTransition2 = BranchWithinLoopReference.createBranchTransition(3, repositoryLookupModel, branch, correspondenceModel);
final Optional<Correspondent> optionCorrespondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4]);
if (optionCorrespondent.isPresent()) {
final Correspondent correspondent = optionCorrespondent.get();
final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModel, correspondent);
UsageModelFactory.addUserAction(loopScenarioBehaviour, entryLevelSystemCall);
UsageModelFactory.connect(branch, entryLevelSystemCall);
UsageModelFactory.connect(entryLevelSystemCall, loopStop);
}
// User sessions according to the reference usage model are created. Thereby, it must be
// ensured that each iteration of the branch the branch probabilities stay the same because
// the branch is iterated. This can be achieved by an equal number of user sessions for each
// branch transition at each iteration of the branch
int countOfCallEvent3 = 0;
int countOfCallEvent4 = 0;
int entryTime = 1;
int exitTime = 2;
boolean branchDecision = false;
// At each iteration the user sessions are distributed equally between the branch
// transitions to ensure that the probabilities of the branch transitions stay equally
final Map<Integer, List<List<UserSession>>> userSessionGroups = new HashMap<>();
final List<List<UserSession>> startList = new ArrayList<>();
startList.add(entryCallSequenceModel.getUserSessions());
userSessionGroups.put(0, startList);
// The loop that contains the branch
for (int j = 0; j < numberOfLoops; j++) {
countOfCallEvent3 = 0;
countOfCallEvent4 = 0;
final List<List<UserSession>> newUserSessionGroups = new ArrayList<>();
// Ensures that the user sessions distribution stays equally
for (int k = 0; k < userSessionGroups.get(j).size(); k++) {
for (int i = 0; i < 2; i++) {
final List<UserSession> userSessions = new ArrayList<>();
newUserSessionGroups.add(userSessions);
}
final int indexGroupCallEvent3 = newUserSessionGroups.size() - 2;
final int indexGroupCallEvent4 = newUserSessionGroups.size() - 1;
for (int i = 0; i < userSessionGroups.get(j).get(k).size(); i++) {
if (newUserSessionGroups.get(indexGroupCallEvent3).size() > newUserSessionGroups.get(indexGroupCallEvent4).size()) {
branchDecision = false;
} else {
branchDecision = true;
}
// The branch within the loop
if (branchDecision) {
BranchWithinLoopReference.createEntryCall(entryTime, exitTime, 2, k, j, i, userSessionGroups, newUserSessionGroups, indexGroupCallEvent3);
countOfCallEvent3++;
entryTime += 2;
exitTime += 2;
} else {
BranchWithinLoopReference.createEntryCall(entryTime, exitTime, 3, k, j, i, userSessionGroups, newUserSessionGroups, indexGroupCallEvent4);
countOfCallEvent4++;
entryTime += 2;
exitTime += 2;
}
final EntryCallEvent entryCallEvent5 = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
userSessionGroups.get(j).get(k).get(i).add(entryCallEvent5, true);
entryTime -= 2;
exitTime -= 2;
}
}
userSessionGroups.put(j + 1, newUserSessionGroups);
entryTime += 2;
exitTime += 2;
}
// Sets the likelihoods of branch transitions
final double likelihoodOfCallEvent3 = (double) countOfCallEvent3 / (double) numberOfConcurrentUsers;
final double likelihoodOfCallEvent4 = (double) countOfCallEvent4 / (double) numberOfConcurrentUsers;
branchTransition1.setBranchProbability(likelihoodOfCallEvent3);
branchTransition2.setBranchProbability(likelihoodOfCallEvent4);
// Saves the reference usage model and sets the usage model and the EntryCallSequenceModel
// as the reference elements. Our approach is now executed with the EntryCallSequenceModel
// and the resulting usage model can be matched against the reference usage model
TestHelper.saveModel(usageModel, referenceUsageModelFileName);
testElements.setEntryCallSequenceModel(entryCallSequenceModel);
testElements.setUsageModel(usageModel);
return testElements;
}
use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.
the class CallSequenceScalabilityReference method getModel.
/**
* It creates a fixed number of user sessions. The number of calls per user session is
* determined by the passed numberOfIterations parameter. It defines how often a fixed call
* sequence is added to the call sequence of each user session. It is used to evaluate the
* approach's response times with an increasing number of calls (RQ-3.2). It returns user
* session that are used to execute the approach and to measure the response time. Thereby, this
* method is called repeatedly to constantly increase the number of calls per UserSession.
*
* @param numberOfIterations
* defines how many calls per user session are created
* @return user sessions
*/
public static ReferenceElements getModel(final int numberOfIterations) {
final ReferenceElements testElements = new ReferenceElements();
final int numberOfUserSessions = 50;
final EntryCallSequenceModel entryCallSequenceModel = new EntryCallSequenceModel(TestHelper.getUserSessions(numberOfUserSessions));
boolean branchDecisionerUserGroup1 = true;
boolean branchDecisionerUserGroup2 = true;
for (int i = 0; i < entryCallSequenceModel.getUserSessions().size(); i++) {
final double userGroupDecisioner = (double) i / (double) numberOfUserSessions;
int entryTime = 1;
int exitTime = 2;
// by their operation signatures
if (userGroupDecisioner < 0.3) {
branchDecisionerUserGroup1 = !branchDecisionerUserGroup1;
// each user session is iterated and thus the number of calls per user session
for (int j = 0; j < numberOfIterations; j++) {
// One single call
EntryCallEvent entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
// An iterated call to represent a loop
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[1], ReferenceUsageModelBuilder.CLASS_SIGNATURE[1], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[1], ReferenceUsageModelBuilder.CLASS_SIGNATURE[1], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
// Alternative calls to represent a branch
final int branchDecisioner = TestHelper.getRandomInteger(2, 1);
if (branchDecisioner == 1) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
} else {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[1], ReferenceUsageModelBuilder.CLASS_SIGNATURE[1], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
// An equal call to merge the branch transitions
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
} else {
branchDecisionerUserGroup2 = !branchDecisionerUserGroup2;
// each user session is iterated and thus the number of calls per user session
for (int j = 0; j < numberOfIterations; j++) {
// One single call
EntryCallEvent entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
// An iterated call to represent a loop
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
// Alternative calls to represent a branch
final int branchDecisioner = TestHelper.getRandomInteger(2, 1);
if (branchDecisioner == 1) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
} else {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
// An equal call to merge the branch transitions
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
}
}
// Returns the created user sessions. Now our approach can be executed and the response
// times can be measured
testElements.setEntryCallSequenceModel(entryCallSequenceModel);
return testElements;
}
use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.
the class LoopWithinBranchReference method createLoop.
/**
* Create a loop code.
*
* @param branchTransitionCounter
* @param startTime
* @param callIndex
* @param loopIndex
* @param entryCallSequenceModel
* @param lengthOfBranchSequence
* @param countOfLoop
* @param i
* @return
*/
private static int createLoop(final List<Integer> branchTransitionCounter, final int startTime, final int callIndex, final int loopIndex, final EntryCallSequenceModel entryCallSequenceModel, final int lengthOfBranchSequence, final int countOfLoop, final int i) {
int entryTime = startTime;
final int countOfBranchTransition = branchTransitionCounter.get(callIndex) + 1;
branchTransitionCounter.set(callIndex, countOfBranchTransition);
EntryCallEvent entryCallEvent = new EntryCallEvent(entryTime, entryTime + 1, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[callIndex], ReferenceUsageModelBuilder.CLASS_SIGNATURE[callIndex], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
if (lengthOfBranchSequence == 2) {
final EntryCallEvent entryCallEvent2 = new EntryCallEvent(entryTime, entryTime + 1, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent2, true);
entryTime += 2;
}
// Within the branch transition the loop is represented by iterated calls
for (int j = 0; j < countOfLoop; j++) {
entryCallEvent = new EntryCallEvent(entryTime, entryTime + 1, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[loopIndex], ReferenceUsageModelBuilder.CLASS_SIGNATURE[loopIndex], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
}
return entryTime;
}
use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.
the class LoopWithinLoopReference method getLoopWithinLoopReferenceModel.
/**
* It creates a reference usage model that contains loops within loops. Accordingly, user
* sessions whose call sequences contain iterated segments that again contain iterated segments
* are created.(RQ-1.7)
*
* @param referenceUsageModelFileName
* file name of the reference model to store its result
* @param repositoryLookupModel
* repository model provider
* @param correspondenceModel
* correspondence model
*
* @return reference usage model and corresponding user sessions
* @throws IOException
* on error
*/
public ReferenceElements getLoopWithinLoopReferenceModel(final String referenceUsageModelFileName, final RepositoryLookupModelProvider repositoryLookupModel, final ICorrespondence correspondenceModel) throws IOException {
// Create a random number of user sessions and random model element parameters. The user
// sessions' behavior will be created according to the reference usage model and
// subsequently the user sessions are used to create a usage model. The created usage model
// is matched against the reference usage model
final int countOfLoop1 = TestHelper.getRandomInteger(4, 2);
final int countOfLoop2 = TestHelper.getRandomInteger(4, 2);
final int lengthOfSubsequentLoopSequence = TestHelper.getRandomInteger(2, 1);
// In the following the reference usage model is created
Optional<Correspondent> optionCorrespondent;
AbstractUserAction lastAction;
final UsageModel usageModel = UsageModelFactory.createUsageModel();
final UsageScenario usageScenario = UsageModelFactory.createUsageScenario("", usageModel);
final ScenarioBehaviour scenarioBehaviour = usageScenario.getScenarioBehaviour_UsageScenario();
final Start start = UsageModelFactory.createStart("");
UsageModelFactory.addUserAction(scenarioBehaviour, start);
final Stop stop = UsageModelFactory.createStop("");
UsageModelFactory.addUserAction(scenarioBehaviour, stop);
lastAction = start;
// The exterior loop is created
final Loop loop = UsageModelFactory.createLoop("", scenarioBehaviour);
UsageModelFactory.connect(lastAction, loop);
UsageModelFactory.connect(loop, stop);
final PCMRandomVariable pcmLoopIteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
pcmLoopIteration.setSpecification(String.valueOf(countOfLoop1));
loop.setLoopIteration_Loop(pcmLoopIteration);
final Start loopStart = UsageModelFactory.createStart("");
UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStart);
final Stop loopStop = UsageModelFactory.createStop("");
UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), loopStop);
lastAction = loopStart;
// The interior loop is created
final Loop loop2 = UsageModelFactory.createLoop("", loop.getBodyBehaviour_Loop());
UsageModelFactory.connect(lastAction, loop2);
final PCMRandomVariable pcmLoop2Iteration = CoreFactory.eINSTANCE.createPCMRandomVariable();
pcmLoop2Iteration.setSpecification(String.valueOf(countOfLoop2));
loop2.setLoopIteration_Loop(pcmLoop2Iteration);
final Start loop2Start = UsageModelFactory.createStart("");
UsageModelFactory.addUserAction(loop2.getBodyBehaviour_Loop(), loop2Start);
final Stop loop2Stop = UsageModelFactory.createStop("");
UsageModelFactory.addUserAction(loop2.getBodyBehaviour_Loop(), loop2Stop);
lastAction = loop2Start;
optionCorrespondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2]);
if (optionCorrespondent.isPresent()) {
final Correspondent correspondent = optionCorrespondent.get();
final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModel, correspondent);
UsageModelFactory.addUserAction(loop2.getBodyBehaviour_Loop(), entryLevelSystemCall);
UsageModelFactory.connect(lastAction, entryLevelSystemCall);
lastAction = entryLevelSystemCall;
}
UsageModelFactory.connect(lastAction, loop2Stop);
lastAction = loop2;
// The sequence that exclusively belongs to the exterior loop is created
for (int i = 0; i < lengthOfSubsequentLoopSequence; i++) {
switch(i) {
case 0:
optionCorrespondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3]);
break;
case 1:
optionCorrespondent = correspondenceModel.getCorrespondent(ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4]);
break;
default:
throw new IllegalArgumentException("Illegal value of model element parameter");
}
if (optionCorrespondent.isPresent()) {
final Correspondent correspondent = optionCorrespondent.get();
final EntryLevelSystemCall entryLevelSystemCall = UsageModelFactory.createEntryLevelSystemCall(repositoryLookupModel, correspondent);
UsageModelFactory.addUserAction(loop.getBodyBehaviour_Loop(), entryLevelSystemCall);
UsageModelFactory.connect(lastAction, entryLevelSystemCall);
lastAction = entryLevelSystemCall;
}
}
UsageModelFactory.connect(lastAction, loopStop);
final int numberOfConcurrentUsers = TestHelper.getRandomInteger(200, 1);
final EntryCallSequenceModel entryCallSequenceModel = new EntryCallSequenceModel(TestHelper.getUserSessions(numberOfConcurrentUsers));
// 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.
int entryTime = 1;
int exitTime = 2;
for (int i = 0; i < entryCallSequenceModel.getUserSessions().size(); i++) {
entryTime = 1;
exitTime = 2;
// Represents the exterior loop of the reference usage model
for (int k = 0; k < countOfLoop1; k++) {
// Represents the interior loop of the reference usage model
for (int j = 0; j < countOfLoop2; j++) {
final EntryCallEvent entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime = entryTime + 2;
exitTime = exitTime + 2;
}
// Calls of the exterior loop
for (int j = 0; j < lengthOfSubsequentLoopSequence; j++) {
EntryCallEvent entryCallEvent = null;
switch(j) {
case 0:
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
break;
case 1:
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[4], ReferenceUsageModelBuilder.CLASS_SIGNATURE[4], String.valueOf(i), "hostname");
break;
default:
throw new IllegalArgumentException("Illegal value of model element parameter");
}
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime = entryTime + 2;
exitTime = exitTime + 2;
}
}
}
// Saves the reference usage model and sets the usage model and the EntryCallSequenceModel
// as the reference elements. Our approach is now executed with the EntryCallSequenceModel
// and the resulting usage model can be matched against the reference usage model
final ReferenceElements referenceElements = new ReferenceElements();
TestHelper.saveModel(usageModel, referenceUsageModelFileName);
referenceElements.setEntryCallSequenceModel(entryCallSequenceModel);
referenceElements.setUsageModel(usageModel);
return referenceElements;
}
use of org.iobserve.stages.general.data.EntryCallEvent in project iobserve-analysis by research-iobserve.
the class OverlappingIterationReference method createMatchingEntryAndExitEvents.
/**
* 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.
*
* @param entryCallSequenceModel
* entry call sequence model which is filled with events
* @param lengthOfSequence1
* length of the first sequence
* @param lengthOfSequence2
* length of the second sequence
* @param loopCount1
* loop counter 1
* @param loopCount2
* loop counter 2
*/
private static void createMatchingEntryAndExitEvents(final EntryCallSequenceModel entryCallSequenceModel, final int lengthOfSequence1, final int lengthOfSequence2, final int loopCount1, final int loopCount2) {
for (int i = 0; i < entryCallSequenceModel.getUserSessions().size(); i++) {
// one is iterated threee times
if (lengthOfSequence1 >= lengthOfSequence2) {
EntryCallEvent entryCallEvent;
int entryTime = 1;
int exitTime = 2;
for (int k = 0; k < loopCount1; k++) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
} else {
EntryCallEvent entryCallEvent;
int entryTime = 1;
int exitTime = 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[0], ReferenceUsageModelBuilder.CLASS_SIGNATURE[0], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
for (int k = 0; k < loopCount2; k++) {
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[2], ReferenceUsageModelBuilder.CLASS_SIGNATURE[2], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
entryCallEvent = new EntryCallEvent(entryTime, exitTime, ReferenceUsageModelBuilder.OPERATION_SIGNATURE[3], ReferenceUsageModelBuilder.CLASS_SIGNATURE[3], String.valueOf(i), "hostname");
entryCallSequenceModel.getUserSessions().get(i).add(entryCallEvent, true);
entryTime += 2;
exitTime += 2;
}
}
}
}
Aggregations