Skip to content
Snippets Groups Projects
Commit be793a72 authored by Sören Henning's avatar Sören Henning
Browse files

worked on dependency graphs

parent ccc93eef
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
Pipeline #
......@@ -5,6 +5,7 @@ package kieker.analysis;
import java.io.File;
import kieker.analysis.dev.OperationsStatisticsDecoratorStage;
import kieker.analysis.dev.SoftwareSystemCreatorStage;
import kieker.analysis.domain.AggregatedTrace;
import kieker.analysis.domain.Trace;
......@@ -89,20 +90,21 @@ public class TraceAnalysisConfiguration extends Configuration {
super.connectPorts(graphDistributor2.getNewOutputPort(), dotTraceGraphFileWriterStage2.getInputPort());
SoftwareSystemCreatorStage softwareSystemCreator = new SoftwareSystemCreatorStage();
OperationsStatisticsDecoratorStage operationsStatisticsDecorator = new OperationsStatisticsDecoratorStage();
Distributor<SoftwareSystem> softwareSystemDistributor = new Distributor<>(new CopyByReferenceStrategy());
// ComponentStatisticsDecoratorStage componentsStatisticsDecorator = new ComponentStatisticsDecoratorStage();
// ContainerStatisticsDecoratorStage containersStatisticsDecorator = new ContainerStatisticsDecoratorStage();
super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), softwareSystemCreator.getInputPort());
super.connectPorts(softwareSystemCreator.getOutputPort(), new AbstractConsumerStage<SoftwareSystem>() {
super.connectPorts(softwareSystemCreator.getOutputPort(), operationsStatisticsDecorator.getInputPort());
super.connectPorts(operationsStatisticsDecorator.getOutputPort(), softwareSystemDistributor.getInputPort());
super.connectPorts(softwareSystemDistributor.getNewOutputPort(), new AbstractConsumerStage<SoftwareSystem>() {
@Override
protected void execute(final SoftwareSystem softwareSystem) {
System.out.println(softwareSystem);
}
}.getInputPort());
// DependencyCreatorStage dependencyCreatorStage = new DependencyCreatorStage();
// DependencyStatisticsDecoratorStage dependencyStatisticsDecoratorStage = new DependencyStatisticsDecoratorStage();
// super.connectPorts(aggregatedTraceDistributor.getNewOutputPort(), dependencyCreatorStage.getInputPort());
// super.connectPorts(dependencyCreatorStage.getOutputPort(), dependencyStatisticsDecoratorStage.getInputPort());
/*
*
*
......
package kieker.analysis.dev;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import kieker.analysis.traceanalysisutil.Statistics;
import kieker.analysis.traceanalysisutil.StatisticsUtility;
import teetime.stage.basic.AbstractTransformation;
public class ComponentStatisticsDecoratorStage extends AbstractTransformation<SoftwareSystem, SoftwareSystem> {
@Override
protected void execute(final SoftwareSystem softwareSystem) {
for (Container container : softwareSystem.getContainers()) {
for (Component component : container.getComponents()) {
// TODO How to handle Statistics?
// All durations of all OperationCalls
List<Long> durations = new ArrayList<>();
for (Operation operation : component.getOperations()) {
List<Long> operationsDurations = operation.getOperationCalls().stream().map(c -> c.getDuration()).collect(Collectors.toList());
durations.addAll(operationsDurations);
}
final Statistics statistics = StatisticsUtility.calculateStatistics(durations);
component.setTotalDuration(statistics.getTotalDuration());
component.setMaxDuration(statistics.getMaxDuration());
component.setMinDuration(statistics.getMinDuration());
component.setMeanDuration(statistics.getMeanDuration());
component.setMedianDuration(statistics.getMedianDuration());
}
}
}
}
package kieker.analysis.dev;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import kieker.analysis.traceanalysisutil.Statistics;
import kieker.analysis.traceanalysisutil.StatisticsUtility;
import teetime.stage.basic.AbstractTransformation;
public class ContainerStatisticsDecoratorStage extends AbstractTransformation<SoftwareSystem, SoftwareSystem> {
@Override
protected void execute(final SoftwareSystem softwareSystem) {
for (Container container : softwareSystem.getContainers()) {
// TODO How to handle Statistics?
// All durations of all OperationCalls
List<Long> durations = new ArrayList<>();
for (Component component : container.getComponents()) {
for (Operation operation : component.getOperations()) {
List<Long> operationsDurations = operation.getOperationCalls().stream().map(c -> c.getDuration()).collect(Collectors.toList());
durations.addAll(operationsDurations);
}
}
final Statistics statistics = StatisticsUtility.calculateStatistics(durations);
container.setTotalDuration(statistics.getTotalDuration());
container.setMaxDuration(statistics.getMaxDuration());
container.setMinDuration(statistics.getMinDuration());
container.setMeanDuration(statistics.getMeanDuration());
container.setMedianDuration(statistics.getMedianDuration());
}
}
}
......@@ -13,6 +13,7 @@ import kieker.analysis.traceanalysisutil.StatisticsUtility;
*
*/
// TODO Maybe make static
@Deprecated
public class DependencyStatisticsDecorator {
public void decorate(final OperationsDependency operationsDependency) {
......
......@@ -8,6 +8,7 @@ import teetime.stage.basic.AbstractTransformation;
* @author Sören Henning
*
*/
@Deprecated
public class DependencyStatisticsDecoratorStage extends AbstractTransformation<OperationsDependency, OperationsDependency> {
private final DependencyStatisticsDecorator statisticsDecorator = new DependencyStatisticsDecorator();
......
package kieker.analysis.dev;
import kieker.analysis.domain.systemdependency.Component;
import kieker.analysis.domain.systemdependency.Container;
import kieker.analysis.domain.systemdependency.Dependency;
import kieker.analysis.domain.systemdependency.Operation;
import kieker.analysis.domain.systemdependency.SoftwareSystem;
import kieker.analysis.util.graph.Edge;
import kieker.analysis.util.graph.Graph;
import kieker.analysis.util.graph.Vertex;
import kieker.analysis.util.graph.impl.GraphImpl;
import teetime.stage.basic.AbstractTransformation;
public class OperationsDependencyGraphCreatorStage extends AbstractTransformation<SoftwareSystem, Graph> {
@Override
protected void execute(final SoftwareSystem softwareSystem) {
Graph graph = new GraphImpl();
for (Container container : softwareSystem.getContainers()) {
Vertex containerVertex = graph.addVertex(container.getIdentifier());
for (Component component : container.getComponents()) {
Vertex componentVertex = graph.addVertex(component.getIdentifier());
for (Operation operation : component.getOperations()) {
Vertex operationVertex = graph.addVertex(operation.getIdentifier());
}
}
}
for (Dependency<Container> containerDependency : softwareSystem.getContainerDependencies()) {
Vertex callerVertex = graph.getVertex(containerDependency.getCaller().getIdentifier());
Vertex calleeVertex = graph.getVertex(containerDependency.getCaller().getIdentifier());
Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex);
dependencyEdge.setProperty("calls", containerDependency.getCalls());
dependencyEdge.setProperty("failuredCalls", containerDependency.getFailuredCalls());
}
for (Dependency<Component> componentDependency : softwareSystem.getComponentDependencies()) {
Vertex callerVertex = graph.getVertex(componentDependency.getCaller().getIdentifier());
Vertex calleeVertex = graph.getVertex(componentDependency.getCaller().getIdentifier());
Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex);
dependencyEdge.setProperty("calls", componentDependency.getCalls());
dependencyEdge.setProperty("failuredCalls", componentDependency.getFailuredCalls());
}
for (Dependency<Operation> operationDependency : softwareSystem.getOperationDependencies()) {
Vertex callerVertex = graph.getVertex(operationDependency.getCaller().getIdentifier());
Vertex calleeVertex = graph.getVertex(operationDependency.getCaller().getIdentifier());
Edge dependencyEdge = graph.addEdge(null, callerVertex, calleeVertex);
dependencyEdge.setProperty("calls", operationDependency.getCalls());
dependencyEdge.setProperty("failuredCalls", operationDependency.getFailuredCalls());
}
this.outputPort.send(graph);
}
}
......@@ -35,6 +35,7 @@ public class OperationsStatisticsDecoratorStage extends AbstractTransformation<S
}
}
this.outputPort.send(softwareSystem);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment