Search in sources :

Example 6 with EntryCallNode

use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.

the class TBehaviorModelVisualization method createNodes.

/**
 * Create new nodes at visualisation backend.
 *
 * @param entryCallNodes
 *            entryCallNodes
 */
private void createNodes(final Set<EntryCallNode> entryCallNodes, final long modelId) {
    final ArrayNode nodes = this.objectMapper.createArrayNode();
    for (final EntryCallNode entryCallNode : entryCallNodes) {
        final ObjectNode json = this.objectMapper.createObjectNode();
        json.put("id", 0);
        json.put("name", this.signatureStrategy.getSignature(entryCallNode));
        final ObjectNode extras = this.objectMapper.createObjectNode();
        for (final CallInformation callInformation : entryCallNode.getEntryCallInformation()) {
            extras.put(callInformation.getInformationSignature(), callInformation.getInformationCode());
        }
        json.put("extra", extras);
        // TODO visualizations doesn't accept lists.
        // TODO is this a requirement request?
        nodes.add(json);
        final JsonNode node = this.postElement(json, this.getNodeUrl(modelId));
        this.nodeMap.put(entryCallNode.getSignature(), node);
    }
}
Also used : CallInformation(org.iobserve.analysis.clustering.filter.models.CallInformation) EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 7 with EntryCallNode

use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.

the class TUsageModelToBehaviorModel method createEntryCallNode.

/**
 * creates an {@link EntryCallNode} from an {@link EntryLevelSystemCall}.
 *
 * @param entryLevelSystemCall
 *            {@link EntryLevelSystemCall}
 * @return entryCallNode
 */
private EntryCallNode createEntryCallNode(final EntryLevelSystemCall entryLevelSystemCall) {
    final String signature = entryLevelSystemCall.getOperationSignature__EntryLevelSystemCall().getEntityName();
    final EntryCallNode entryCallNode = new EntryCallNode(signature);
    return entryCallNode;
}
Also used : EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode)

Example 8 with EntryCallNode

use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.

the class TUsageModelToBehaviorModel method traverseAction.

private Map<EntryCallNode, Double> traverseAction(final BehaviorModel behaviorModel, final Optional<Map<EntryCallNode, Double>> optPreviousNodes, final AbstractUserAction action) {
    if (action instanceof Branch) {
        final Branch branch = (Branch) action;
        return this.traverseBranch(behaviorModel, optPreviousNodes, branch);
    } else if (action instanceof Loop) {
        final Loop loop = (Loop) action;
        return this.traverseLoop(behaviorModel, optPreviousNodes, loop);
    } else if (action instanceof EntryLevelSystemCall) {
        final Map<EntryCallNode, Double> endNodes = new HashMap<>();
        final EntryLevelSystemCall entryLevelSystemCall = (EntryLevelSystemCall) action;
        final EntryCallNode entryCallNode = this.createEntryCallNode(entryLevelSystemCall);
        behaviorModel.addNode(entryCallNode);
        if (optPreviousNodes.isPresent()) {
            optPreviousNodes.get().keySet().stream().map(previousNode -> new EntryCallEdge(previousNode, entryCallNode, optPreviousNodes.get().get(previousNode))).forEach(behaviorModel::addEdge);
        }
        endNodes.put(entryCallNode, 1.0);
        return this.traverseAction(behaviorModel, Optional.of(endNodes), action.getSuccessor());
    } else if (action instanceof Stop) {
        return optPreviousNodes.isPresent() ? optPreviousNodes.get() : new HashMap<>();
    } else {
        // skip action
        return this.traverseAction(behaviorModel, optPreviousNodes, action.getSuccessor());
    }
}
Also used : Loop(org.palladiosimulator.pcm.usagemodel.Loop) SingleOrNoneCollector(org.iobserve.analysis.clustering.SingleOrNoneCollector) BranchTransition(org.palladiosimulator.pcm.usagemodel.BranchTransition) UsageScenario(org.palladiosimulator.pcm.usagemodel.UsageScenario) EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) HashMap(java.util.HashMap) OutputPort(teetime.framework.OutputPort) AbstractUserAction(org.palladiosimulator.pcm.usagemodel.AbstractUserAction) List(java.util.List) AbstractConsumerStage(teetime.framework.AbstractConsumerStage) Map(java.util.Map) BehaviorModel(org.iobserve.analysis.clustering.filter.models.BehaviorModel) EntryCallEdge(org.iobserve.analysis.clustering.filter.models.EntryCallEdge) Optional(java.util.Optional) EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode) UsageModel(org.palladiosimulator.pcm.usagemodel.UsageModel) Branch(org.palladiosimulator.pcm.usagemodel.Branch) Start(org.palladiosimulator.pcm.usagemodel.Start) Loop(org.palladiosimulator.pcm.usagemodel.Loop) ScenarioBehaviour(org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour) Stop(org.palladiosimulator.pcm.usagemodel.Stop) EntryCallEdge(org.iobserve.analysis.clustering.filter.models.EntryCallEdge) EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode) HashMap(java.util.HashMap) Stop(org.palladiosimulator.pcm.usagemodel.Stop) Branch(org.palladiosimulator.pcm.usagemodel.Branch)

Example 9 with EntryCallNode

use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.

the class ComparisonOutputStage method generateNodeCallInformation.

private void generateNodeCallInformation(final BufferedWriter writer, final String prefix, final List<EntryCallNode> allNodes, final List<EntryCallNode> selectedNodes) throws IOException {
    for (final EntryCallNode referenceNode : allNodes) {
        final EntryCallNode printNode = this.findNode(selectedNodes, referenceNode);
        if (printNode != null) {
            final Set<CallInformation> allEntryCallInformation = this.generateAllEntryCallInformationList(referenceNode.getEntryCallInformation(), printNode.getEntryCallInformation());
            writer.write(prefix + printNode.getSignature().substring(18) + "\n");
            this.generateCallInformation(writer, prefix + "\t", allEntryCallInformation, printNode.getEntryCallInformation());
        } else {
            writer.write(prefix + " -- \n");
        }
    }
}
Also used : CallInformation(org.iobserve.analysis.clustering.filter.models.CallInformation) EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode)

Example 10 with EntryCallNode

use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.

the class ComparisonOutputStage method createAllNodesList.

/**
 * Get all nodes used in this comparison.
 *
 * @param baselineNodes
 * @param testModelNodes
 * @return
 */
private List<EntryCallNode> createAllNodesList(final List<EntryCallNode> baselineNodes, final List<EntryCallNode> testModelNodes) {
    final List<EntryCallNode> result = new ArrayList<>();
    result.addAll(baselineNodes);
    for (final EntryCallNode node : testModelNodes) {
        if (!this.nodeExists(baselineNodes, node)) {
            result.add(node);
        }
    }
    return result;
}
Also used : EntryCallNode(org.iobserve.analysis.clustering.filter.models.EntryCallNode) ArrayList(java.util.ArrayList)

Aggregations

EntryCallNode (org.iobserve.analysis.clustering.filter.models.EntryCallNode)11 CallInformation (org.iobserve.analysis.clustering.filter.models.CallInformation)5 EntryCallEdge (org.iobserve.analysis.clustering.filter.models.EntryCallEdge)5 AbstractUserAction (org.palladiosimulator.pcm.usagemodel.AbstractUserAction)3 Branch (org.palladiosimulator.pcm.usagemodel.Branch)3 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)3 Loop (org.palladiosimulator.pcm.usagemodel.Loop)3 Stop (org.palladiosimulator.pcm.usagemodel.Stop)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Optional (java.util.Optional)2 SingleOrNoneCollector (org.iobserve.analysis.clustering.SingleOrNoneCollector)2 BehaviorModel (org.iobserve.analysis.clustering.filter.models.BehaviorModel)2 NodeDifference (org.iobserve.evaluation.data.NodeDifference)2 BranchTransition (org.palladiosimulator.pcm.usagemodel.BranchTransition)2 ScenarioBehaviour (org.palladiosimulator.pcm.usagemodel.ScenarioBehaviour)2 Start (org.palladiosimulator.pcm.usagemodel.Start)2 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)2 UsageScenario (org.palladiosimulator.pcm.usagemodel.UsageScenario)2