Skip to content
Snippets Groups Projects
Commit 3a8d6958 authored by Jürgen Walter's avatar Jürgen Walter
Browse files

minor

parent dccabbda
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,13 @@
package tools.descartes.pmx.filter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.apache.log4j.Logger;
import kieker.analysis.IProjectContext;
import kieker.analysis.plugin.annotation.InputPort;
import kieker.analysis.plugin.annotation.OutputPort;
......@@ -39,11 +43,6 @@ import kieker.tools.traceAnalysis.filter.AbstractMessageTraceProcessingFilter;
import kieker.tools.traceAnalysis.systemModel.AbstractMessage;
import kieker.tools.traceAnalysis.systemModel.Execution;
import kieker.tools.traceAnalysis.systemModel.MessageTrace;
import org.apache.log4j.Logger;
import tools.descartes.librede.linalg.LinAlg;
import tools.descartes.librede.linalg.Vector;
import tools.descartes.pmx.builder.ModelBuilder;
@Plugin(name = "WorkloadFilter", description = "...", outputPorts = { @OutputPort(name = WorkloadFilter.OUTPUT_PORT_NAME_WORKLOAD, description = "Outputs workload description", eventTypes = { HashMap.class }), })
......@@ -65,7 +64,7 @@ public class WorkloadFilter extends AbstractMessageTraceProcessingFilter {
@InputPort(name = AbstractMessageTraceProcessingFilter.INPUT_PORT_NAME_MESSAGE_TRACES, description = "Receives the message traces to be processed",
eventTypes = { MessageTrace.class })
public void inputMessageTraces(final MessageTrace mt) {
AbstractMessage startMessage = mt.getSequenceAsVector().get(0);
AbstractMessage startMessage = getStartMessage(mt);// mt.getSequenceAsVector().get(0);
Execution x = startMessage.getReceivingExecution();
String host = x.getAllocationComponent().getExecutionContainer().getName();
String function = x.getOperation().getSignature().getName();
......@@ -73,6 +72,41 @@ public class WorkloadFilter extends AbstractMessageTraceProcessingFilter {
addTimeStamp(host, component, function, x.getTin());
}
private AbstractMessage getStartMessage(final MessageTrace mt) {
for (AbstractMessage message : mt.getSequenceAsVector()) {
// System.out.println("\t" +
// message.getReceivingExecution().getOperation().getSignature().getName()
// + " "
// + message.getTimestamp() + " " + mt.getStartTimestamp());
if (message.getTimestamp() == mt.getStartTimestamp()) {
return message;
}
}
return mt.getSequenceAsVector().get(0);
}
private void sortMessageTrace(final MessageTrace mt) {
List<AbstractMessage> messages = mt.getSequenceAsVector();
Comparator<AbstractMessage> timeComparator = new Comparator<AbstractMessage>() {
@Override
public int compare(AbstractMessage arg0, AbstractMessage arg1) {
if (arg0.getTimestamp() > arg1.getTimestamp()) {
return 1;
} else if (arg0.getTimestamp() < arg1.getTimestamp()) {
return -1;
} else {
return 0;
}
}
};
Collections.sort(messages, timeComparator);
// for (AbstractMessage message : messages) {
// System.out.println(
// "" + message.getSendingExecution().getOperation() + " " +
// message.getSendingExecution().getEoi());
// }
}
private synchronized void addTimeStamp(String host, String component, String function, double timestamp){
List<Double> timeSeries;
String key = function+ModelBuilder.seperatorChar+component+ModelBuilder.seperatorChar+host;
......
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