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

fixed encoding

parent cf165fd4
No related branches found
No related tags found
No related merge requests found
Showing
with 32 additions and 32 deletions
...@@ -123,7 +123,7 @@ public class NextStageScheduler implements IStageScheduler { ...@@ -123,7 +123,7 @@ public class NextStageScheduler implements IStageScheduler {
this.stopWatch.end(); this.stopWatch.end();
this.durationInNs += this.stopWatch.getDuration(); this.durationInNs += this.stopWatch.getDurationInNs();
if ((this.iterations % 10000) == 0) { if ((this.iterations % 10000) == 0) {
this.durations.add(this.durationInNs); this.durations.add(this.durationInNs);
this.durationInNs = 0; this.durationInNs = 0;
......
...@@ -78,7 +78,7 @@ public class WorkerThread extends Thread { ...@@ -78,7 +78,7 @@ public class WorkerThread extends Thread {
this.stageScheduler.determineNextStage(stage, executedSuccessfully); this.stageScheduler.determineNextStage(stage, executedSuccessfully);
this.iterationStopWatch.end(); this.iterationStopWatch.end();
final long schedulingOverhead = this.iterationStopWatch.getDuration() - stage.getLastDuration(); final long schedulingOverhead = this.iterationStopWatch.getDurationInNs() - stage.getLastDuration();
schedulingOverheadInNs += schedulingOverhead; schedulingOverheadInNs += schedulingOverhead;
if ((iterations % 10000) == 0) { if ((iterations % 10000) == 0) {
this.schedulingOverheadsInNs.add(schedulingOverheadInNs); this.schedulingOverheadsInNs.add(schedulingOverheadInNs);
...@@ -87,7 +87,7 @@ public class WorkerThread extends Thread { ...@@ -87,7 +87,7 @@ public class WorkerThread extends Thread {
} }
this.stopWatch.end(); this.stopWatch.end();
this.durationInNs = this.stopWatch.getDuration(); this.durationInNs = this.stopWatch.getDurationInNs();
final List<Long> durations = ((NextStageScheduler) this.stageScheduler).getDurations(); final List<Long> durations = ((NextStageScheduler) this.stageScheduler).getDurations();
long overallDuration = 0; long overallDuration = 0;
......
...@@ -128,7 +128,7 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp ...@@ -128,7 +128,7 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp
return success; return success;
} finally { } finally {
this.stopWatch.end(); this.stopWatch.end();
this.lastDuration = this.stopWatch.getDuration(); this.lastDuration = this.stopWatch.getDurationInNs();
this.overallDurationInNs += this.lastDuration; this.overallDurationInNs += this.lastDuration;
} }
} }
......
...@@ -62,20 +62,20 @@ public class StatisticsUtil { ...@@ -62,20 +62,20 @@ public class StatisticsUtil {
final Map<Double, Long> quintileValues = StatisticsUtil.calculateQuintiles(sortedDurationsInNs); final Map<Double, Long> quintileValues = StatisticsUtil.calculateQuintiles(sortedDurationsInNs);
System.out.println("min: " + TimeUnit.NANOSECONDS.toMicros(minDurationInNs) + " s"); System.out.println("min: " + TimeUnit.NANOSECONDS.toMicros(minDurationInNs) + " µs");
System.out.println("max: " + TimeUnit.NANOSECONDS.toMicros(maxDurationInNs) + " s"); System.out.println("max: " + TimeUnit.NANOSECONDS.toMicros(maxDurationInNs) + " µs");
final long avgDurInNs = sumInNs / (timestampObjects.size() / 2); final long avgDurInNs = sumInNs / (timestampObjects.size() / 2);
System.out.println("avg duration: " + TimeUnit.NANOSECONDS.toMicros(avgDurInNs) + " s"); System.out.println("avg duration: " + TimeUnit.NANOSECONDS.toMicros(avgDurInNs) + " µs");
for (final Entry<Double, Long> entry : quintileValues.entrySet()) { for (final Entry<Double, Long> entry : quintileValues.entrySet()) {
System.out.println((entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toMicros(entry.getValue()) + " s"); System.out.println((entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toMicros(entry.getValue()) + " µs");
} }
final long confidenceWidthInNs = StatisticsUtil.calculateConfidenceWidth(sortedDurationsInNs, avgDurInNs); final long confidenceWidthInNs = StatisticsUtil.calculateConfidenceWidth(sortedDurationsInNs, avgDurInNs);
System.out.println("confidenceWidth: " + confidenceWidthInNs + " ns"); System.out.println("confidenceWidth: " + confidenceWidthInNs + " ns");
System.out.println("[" + TimeUnit.NANOSECONDS.toMicros(avgDurInNs - confidenceWidthInNs) + " s, " System.out.println("[" + TimeUnit.NANOSECONDS.toMicros(avgDurInNs - confidenceWidthInNs) + " µs, "
+ TimeUnit.NANOSECONDS.toMicros(avgDurInNs + confidenceWidthInNs) + " s]"); + TimeUnit.NANOSECONDS.toMicros(avgDurInNs + confidenceWidthInNs) + " µs]");
} }
public static long calculateConfidenceWidth(final List<Long> durations, final long avgDurInNs) { public static long calculateConfidenceWidth(final List<Long> durations, final long avgDurInNs) {
......
...@@ -2,18 +2,18 @@ package teetime.util; ...@@ -2,18 +2,18 @@ package teetime.util;
public final class StopWatch { public final class StopWatch {
private long startTimeInMs; private long startTimeInNs;
private long endTimeInMs; private long endTimeInNs;
public final void start() { public final void start() {
this.startTimeInMs = System.nanoTime(); this.startTimeInNs = System.nanoTime();
} }
public final void end() { public final void end() {
this.endTimeInMs = System.nanoTime(); this.endTimeInNs = System.nanoTime();
} }
public final long getDuration() { public final long getDurationInNs() {
return this.endTimeInMs - this.startTimeInMs; return this.endTimeInNs - this.startTimeInNs;
} }
} }
...@@ -68,7 +68,7 @@ public class MethodCallThoughputTimestampAnalysisTest { ...@@ -68,7 +68,7 @@ public class MethodCallThoughputTimestampAnalysisTest {
stopWatch.end(); stopWatch.end();
} }
StatisticsUtil.printStatistics(stopWatch.getDuration(), timestampObjects); StatisticsUtil.printStatistics(stopWatch.getDurationInNs(), timestampObjects);
} }
} }
...@@ -63,11 +63,11 @@ public class ThroughputAnalysisTest { ...@@ -63,11 +63,11 @@ public class ThroughputAnalysisTest {
stopWatch.end(); stopWatch.end();
} }
durations[i] = stopWatch.getDuration(); durations[i] = stopWatch.getDurationInNs();
} }
// for (final long dur : durations) { // for (final long dur : durations) {
// System.out.println("Duration: " + (dur / 1000) + " s"); // System.out.println("Duration: " + (dur / 1000) + " µs");
// } // }
long sum = 0; long sum = 0;
...@@ -76,7 +76,7 @@ public class ThroughputAnalysisTest { ...@@ -76,7 +76,7 @@ public class ThroughputAnalysisTest {
} }
final long avgDur = sum / (numRuns / 2); final long avgDur = sum / (numRuns / 2);
System.out.println("avg duration: " + (avgDur / 1000) + " s"); System.out.println("avg duration: " + (avgDur / 1000) + " µs");
} }
} }
...@@ -81,7 +81,7 @@ public class ThroughputTimestampAnalysisTest { ...@@ -81,7 +81,7 @@ public class ThroughputTimestampAnalysisTest {
stopWatch.end(); stopWatch.end();
} }
StatisticsUtil.printStatistics(stopWatch.getDuration(), timestampObjects); StatisticsUtil.printStatistics(stopWatch.getDurationInNs(), timestampObjects);
} }
} }
...@@ -28,7 +28,7 @@ public class CircularWorkStealingDequeTest { ...@@ -28,7 +28,7 @@ public class CircularWorkStealingDequeTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), Assert.assertThat(this.stopWatch.getDurationInNs(),
OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -27,6 +27,6 @@ public class CircularWorkStealingDequeTest { ...@@ -27,6 +27,6 @@ public class CircularWorkStealingDequeTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -29,6 +29,6 @@ public class CircularWorkStealingDequeWithSentinelTest { ...@@ -29,6 +29,6 @@ public class CircularWorkStealingDequeWithSentinelTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -29,6 +29,6 @@ public class CircularWorkStealingDequeWithThreadLocalSentinelTest { ...@@ -29,6 +29,6 @@ public class CircularWorkStealingDequeWithThreadLocalSentinelTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -34,6 +34,6 @@ public class ExceptionalCircularWorkStealingDequeTest { ...@@ -34,6 +34,6 @@ public class ExceptionalCircularWorkStealingDequeTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -10,7 +10,7 @@ import teetime.util.StopWatch; ...@@ -10,7 +10,7 @@ import teetime.util.StopWatch;
public class UntypedCircularWorkStealingDequeTest { public class UntypedCircularWorkStealingDequeTest {
public static final int NUM_ITERATIONS = 100000000; public static final int NUM_ITERATIONS = 100000000;
public static final long EXPECTED_DURATION = 1100; public static final long EXPECTED_DURATION_IN_NS = 1100*1000*1000;
private StopWatch stopWatch; private StopWatch stopWatch;
...@@ -30,6 +30,6 @@ public class UntypedCircularWorkStealingDequeTest { ...@@ -30,6 +30,6 @@ public class UntypedCircularWorkStealingDequeTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
} }
} }
...@@ -36,7 +36,7 @@ public class UntypedExceptionalCircularWorkStealingDequeTest { ...@@ -36,7 +36,7 @@ public class UntypedExceptionalCircularWorkStealingDequeTest {
} }
this.stopWatch.end(); this.stopWatch.end();
Assert.assertThat(this.stopWatch.getDuration(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION)); Assert.assertThat(this.stopWatch.getDurationInNs(), OrderingComparison.lessThan(UntypedCircularWorkStealingDequeTest.EXPECTED_DURATION_IN_NS));
Assert.assertThat(counter, OrderingComparison.comparesEqualTo(UntypedCircularWorkStealingDequeTest.NUM_ITERATIONS)); Assert.assertThat(counter, OrderingComparison.comparesEqualTo(UntypedCircularWorkStealingDequeTest.NUM_ITERATIONS));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment