Commit 2a2f7843 authored by Florian Fittkau's avatar Florian Fittkau

response times in explorviz

parent 46f635cb
......@@ -2,6 +2,7 @@ package explorviz.live_trace_processing.filter.reconstruction;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import explorviz.live_trace_processing.Constants;
import explorviz.live_trace_processing.reader.TimeProvider;
......@@ -75,6 +76,18 @@ class TraceReconstructionBuffer {
}
public final Trace toTrace(final boolean valid) {
final Stack<AbstractEventRecord> stack = new Stack<AbstractEventRecord>();
for (final AbstractEventRecord event : events) {
if (event instanceof AbstractBeforeEventRecord) {
stack.push(event);
} else if ((event instanceof AbstractAfterEventRecord)
|| (event instanceof AbstractAfterFailedEventRecord)) {
final AbstractEventRecord beforeEvent = stack.pop();
final long time = event.getLoggingTimestamp() - beforeEvent.getLoggingTimestamp();
beforeEvent.getRuntime().set(time);
}
}
return new Trace(events, valid);
}
}
......@@ -2,6 +2,7 @@ package explorviz.live_trace_processing.filter.reduction.summarization;
import java.util.List;
import explorviz.live_trace_processing.record.event.AbstractBeforeEventRecord;
import explorviz.live_trace_processing.record.event.AbstractEventRecord;
import explorviz.live_trace_processing.record.trace.Trace;
......@@ -25,12 +26,14 @@ class TracePatternSummarizationBuffer {
if (accumulator == null) {
accumulator = trace;
} else {
final List<AbstractEventRecord> aggregatedRecords = accumulator
.getTraceEvents();
final List<AbstractEventRecord> aggregatedRecords = accumulator.getTraceEvents();
final List<AbstractEventRecord> records = trace.getTraceEvents();
for (int i = 0; i < aggregatedRecords.size(); i++) {
aggregatedRecords.get(i).getRuntime().merge(records.get(i).getRuntime());
final AbstractEventRecord event = aggregatedRecords.get(i);
if (event instanceof AbstractBeforeEventRecord) {
aggregatedRecords.get(i).getRuntime().merge(records.get(i).getRuntime());
}
}
}
}
......
......@@ -15,7 +15,7 @@ public class TraceReconstructionBufferTest {
final TraceReconstructionBuffer traceReconstructionBuffer = new TraceReconstructionBuffer();
traceReconstructionBuffer.insertEvent(new BeforeOperationEventRecord(1000, 1, 0, 0, "test",
new HostApplicationMetaDataRecord("testHost", "testApp"),
new RuntimeStatisticInformation(1000)));
new RuntimeStatisticInformation()));
assertTrue(true); // TODO
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment