Skip to content
Snippets Groups Projects
Commit 70b38d4f authored by Christian Wulf's avatar Christian Wulf
Browse files

moved ISendTraceBuffer to ctor

parent 813304cc
No related branches found
No related tags found
No related merge requests found
#FindBugs User Preferences
#Thu Feb 19 16:40:02 CET 2015
#Wed Feb 25 09:07:58 CET 2015
detector_threshold=3
effort=max
excludefilter0=.fbExcludeFilterFile|true
......
......@@ -139,34 +139,34 @@
</plugin>
<!-- goals to build a jar with binaries: jar:jar, jar:test-jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-jar-plugin</artifactId> -->
<!-- <version>2.5</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <goals> -->
<!-- <goal>test-jar</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- </plugin> -->
<!-- copies all dependencies as separate jars into the target folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-dependency-plugin</artifactId> -->
<!-- <version>2.10</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <id>copy-dependencies</id> -->
<!-- <phase>package</phase> -->
<!-- <goals> -->
<!-- <goal>copy-dependencies</goal> -->
<!-- </goals> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -44,17 +44,17 @@ public class TraceReconstructionFilter extends AbstractConsumerStage<IFlowRecord
public TraceReconstructionFilter(final ConcurrentHashMapWithDefault<Long, EventBasedTrace> traceId2trace) {
super();
this.reconstructor = new TraceReconstructor(traceId2trace);
this.reconstructor = new TraceReconstructor(traceId2trace, this);
}
@Override
protected void execute(final IFlowRecord element) {
reconstructor.execute(element, this);
reconstructor.execute(element);
}
@Override
public void onTerminating() throws Exception {
reconstructor.terminate(this);
reconstructor.terminate();
super.onTerminating();
}
......
......@@ -16,9 +16,11 @@ import kieker.common.record.flow.trace.TraceMetadata;
public class TraceReconstructor {
private final ConcurrentHashMapWithDefault<Long, EventBasedTrace> traceId2trace;
private final ISendTraceBuffer sender;
public TraceReconstructor(final ConcurrentHashMapWithDefault<Long, EventBasedTrace> traceId2trace) {
public TraceReconstructor(final ConcurrentHashMapWithDefault<Long, EventBasedTrace> traceId2trace, final ISendTraceBuffer sender) {
this.traceId2trace = traceId2trace;
this.sender = sender;
}
private Long reconstructTrace(final IFlowRecord record) {
......@@ -58,13 +60,13 @@ public class TraceReconstructor {
}
}
public void terminate(final ISendTraceBuffer sender) {
public void terminate() {
for (Long traceId : traceId2trace.keySet()) {
this.put(traceId, false, sender);
}
}
public void execute(final IFlowRecord record, final ISendTraceBuffer sender) {
public void execute(final IFlowRecord record) {
final Long traceId = this.reconstructTrace(record);
if (traceId != null) {
this.put(traceId, true, sender);
......
......@@ -15,15 +15,9 @@
***************************************************************************/
package teetime.examples.traceReconstructionWithThreads;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.junit.After;
......@@ -35,7 +29,6 @@ import org.junit.runners.MethodSorters;
import teetime.framework.Analysis;
import teetime.util.ListUtil;
import teetime.util.StopWatch;
import util.test.eval.StatisticsUtil;
/**
* @author Christian Wulf
......@@ -46,7 +39,7 @@ import util.test.eval.StatisticsUtil;
public class ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest {
private static final int MIO = 1000000;
private static final int EXPECTED_NUM_TRACES = 10 * MIO;
private static final int EXPECTED_NUM_TRACES = 1 * MIO;
private static final int EXPECTED_NUM_RECORDS = 21 * EXPECTED_NUM_TRACES + 1;
private StopWatch stopWatch;
......@@ -102,8 +95,8 @@ public class ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest {
// System.out.println("Median trace delay: " + traceQuintiles.get(0.5) + " time units/trace");
List<Long> recordThroughputs = ListUtil.removeFirstHalfElements(configuration.getRecordThroughputs());
Map<Double, Long> recordQuintiles = StatisticsUtil.calculateQuintiles(recordThroughputs);
System.out.println("Median record throughput: " + recordQuintiles.get(0.5) + " elements/time unit");
// Map<Double, Long> recordQuintiles = StatisticsUtil.calculateQuintiles(recordThroughputs);
// System.out.println("Median record throughput: " + recordQuintiles.get(0.5) + " elements/time unit");
// List<Long> traceThroughputs = ListUtil.removeFirstHalfElements(analysis.getTraceThroughputs());
// Map<Double, Long> traceQuintiles = StatisticsUtil.calculateQuintiles(traceThroughputs);
......@@ -123,7 +116,7 @@ public class ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest {
}
// 08.07.2014 (incl.)
assertThat(recordQuintiles.get(0.5), is(both(greaterThan(3100L)).and(lessThan(3500L))));
// assertThat(recordQuintiles.get(0.5), is(both(greaterThan(3100L)).and(lessThan(3500L))));
}
public static void main(final String[] args) {
......
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