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

Merge branch 'checkstyle-solved' into 'master'

Checkstyle solved

Solved a whole bunch of issues regarding checkstyle. For e.g. renamed interfaces to match I[A-Z0-9].* and abstract classes to match Abstract[A-Z0-9].*

See merge request !16
parents 6ff65096 bec9f5bc
No related branches found
No related tags found
No related merge requests found
Showing
with 57 additions and 51 deletions
...@@ -17,29 +17,31 @@ import com.google.common.base.Charsets; ...@@ -17,29 +17,31 @@ import com.google.common.base.Charsets;
import com.google.common.io.CharSource; import com.google.common.io.CharSource;
import com.google.common.io.Files; import com.google.common.io.Files;
public class BucketTimingsReader { public final class BucketTimingsReader {
private final static Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class); private static final Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class);
private BucketTimingsReader() {}
public static void main(final String[] args) throws IOException { public static void main(final String[] args) throws IOException {
String fileName = args[0]; final String fileName = args[0];
Long[] currentTimings = new Long[10000]; final Long[] currentTimings = new Long[10000];
int processedLines = 0; int processedLines = 0;
List<Long> buckets = new LinkedList<Long>(); final List<Long> buckets = new LinkedList<Long>();
LOGGER.trace("Reading " + fileName); LOGGER.trace("Reading " + fileName);
CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8); final CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8);
BufferedReader bufferedStream = charSource.openBufferedStream(); final BufferedReader bufferedStream = charSource.openBufferedStream();
String line; String line;
while (null != (line = bufferedStream.readLine())) { while (null != (line = bufferedStream.readLine())) {
String[] strings = line.split(";"); final String[] strings = line.split(";");
Long timing = new Long(strings[1]); final Long timing = new Long(strings[1]);
currentTimings[processedLines] = timing; currentTimings[processedLines] = timing;
processedLines++; processedLines++;
if (currentTimings.length == processedLines) { if (currentTimings.length == processedLines) {
// Long aggregatedTimings = StatisticsUtil.calculateQuintiles(Arrays.asList(currentTimings)).get(0.5); // Long aggregatedTimings = StatisticsUtil.calculateQuintiles(Arrays.asList(currentTimings)).get(0.5);
Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings)); final Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings));
buckets.add(aggregatedTimings); buckets.add(aggregatedTimings);
processedLines = 0; processedLines = 0;
} }
...@@ -47,13 +49,13 @@ public class BucketTimingsReader { ...@@ -47,13 +49,13 @@ public class BucketTimingsReader {
LOGGER.trace("#buckets: " + buckets.size()); LOGGER.trace("#buckets: " + buckets.size());
List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size()); final List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size());
LOGGER.trace("Calculating quantiles..."); LOGGER.trace("Calculating quantiles...");
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs); final Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs);
LOGGER.info(StatisticsUtil.getQuantilesString(quintiles)); LOGGER.info(StatisticsUtil.getQuantilesString(quintiles));
long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs); final long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs);
LOGGER.info("Confidence width: " + confidenceWidth); LOGGER.info("Confidence width: " + confidenceWidth);
} }
} }
...@@ -15,7 +15,7 @@ public class MooBenchStarter { ...@@ -15,7 +15,7 @@ public class MooBenchStarter {
} }
public void start(final int runs, final long calls) throws IOException { public void start(final int runs, final long calls) throws IOException {
List<String> command = new LinkedList<String>(); final List<String> command = new LinkedList<String>();
command.add("cmd"); command.add("cmd");
command.add("/c"); command.add("/c");
command.add("start"); command.add("start");
......
package util.test; package util.test;
public abstract class ProfiledPerformanceAssertion { public abstract class AbstractProfiledPerformanceAssertion {
public abstract String getCorrespondingPerformanceProfile(); public abstract String getCorrespondingPerformanceProfile();
......
...@@ -7,6 +7,8 @@ public class MeasurementRepository { ...@@ -7,6 +7,8 @@ public class MeasurementRepository {
public final Map<String, PerformanceResult> performanceResults = new HashMap<String, PerformanceResult>(); public final Map<String, PerformanceResult> performanceResults = new HashMap<String, PerformanceResult>();
public MeasurementRepository() {}
public static final String buildTestMethodIdentifier(final Class<?> testClass, final String methodName) { public static final String buildTestMethodIdentifier(final Class<?> testClass, final String methodName) {
return testClass.getName() + "(" + methodName + ")"; return testClass.getName() + "(" + methodName + ")";
} }
......
...@@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory; ...@@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory;
public class PerformanceCheckProfileRepository { public class PerformanceCheckProfileRepository {
private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class);
public static final PerformanceCheckProfileRepository INSTANCE = new PerformanceCheckProfileRepository(); public static final PerformanceCheckProfileRepository INSTANCE = new PerformanceCheckProfileRepository();
private final Map<Class<?>, ProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, ProfiledPerformanceAssertion>(); private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class);
private final Map<Class<?>, AbstractProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, AbstractProfiledPerformanceAssertion>();
private String currentProfile; private String currentProfile;
...@@ -29,13 +29,13 @@ public class PerformanceCheckProfileRepository { ...@@ -29,13 +29,13 @@ public class PerformanceCheckProfileRepository {
return this.currentProfile; return this.currentProfile;
} }
public void register(final Class<?> testClass, final ProfiledPerformanceAssertion profile) { public void register(final Class<?> testClass, final AbstractProfiledPerformanceAssertion profile) {
if (profile.getCorrespondingPerformanceProfile().equals(this.currentProfile)) { if (profile.getCorrespondingPerformanceProfile().equals(this.currentProfile)) {
this.performanceCheckProfiles.put(testClass, profile); this.performanceCheckProfiles.put(testClass, profile);
} }
} }
public ProfiledPerformanceAssertion get(final Class<?> clazz) { public AbstractProfiledPerformanceAssertion get(final Class<?> clazz) {
return this.performanceCheckProfiles.get(clazz); return this.performanceCheckProfiles.get(clazz);
} }
} }
...@@ -10,9 +10,11 @@ public class PerformanceResult { ...@@ -10,9 +10,11 @@ public class PerformanceResult {
public long avgDurInNs; public long avgDurInNs;
public long confidenceWidthInNs; public long confidenceWidthInNs;
public PerformanceResult() {}
@Override @Override
public String toString() { public String toString() {
StringBuilder stringBuilder = new StringBuilder(); final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("overallDurationInNs: "); stringBuilder.append("overallDurationInNs: ");
stringBuilder.append(this.overallDurationInNs); stringBuilder.append(this.overallDurationInNs);
stringBuilder.append("\n"); stringBuilder.append("\n");
......
...@@ -42,7 +42,7 @@ public final class StatisticsUtil { ...@@ -42,7 +42,7 @@ public final class StatisticsUtil {
} }
public static PerformanceResult computeStatistics(final long overallDurationInNs, final List<TimestampObject> timestampObjects) { public static PerformanceResult computeStatistics(final long overallDurationInNs, final List<TimestampObject> timestampObjects) {
PerformanceResult performanceResult = new PerformanceResult(); final PerformanceResult performanceResult = new PerformanceResult();
performanceResult.overallDurationInNs = overallDurationInNs; performanceResult.overallDurationInNs = overallDurationInNs;
...@@ -71,9 +71,9 @@ public final class StatisticsUtil { ...@@ -71,9 +71,9 @@ public final class StatisticsUtil {
} }
public static String getQuantilesString(final Map<Double, Long> quantilesValues) { public static String getQuantilesString(final Map<Double, Long> quantilesValues) {
StringBuilder builder = new StringBuilder(); final StringBuilder builder = new StringBuilder();
for (final Entry<Double, Long> entry : quantilesValues.entrySet()) { for (final Entry<Double, Long> entry : quantilesValues.entrySet()) {
String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns"; final String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns";
builder.append(quantile); builder.append(quantile);
builder.append("\n"); builder.append("\n");
} }
...@@ -113,7 +113,7 @@ public final class StatisticsUtil { ...@@ -113,7 +113,7 @@ public final class StatisticsUtil {
} }
public static void removeLeadingZeroThroughputs(final List<Long> throughputs) { public static void removeLeadingZeroThroughputs(final List<Long> throughputs) {
Iterator<Long> iterator = throughputs.iterator(); final Iterator<Long> iterator = throughputs.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
if (iterator.next() == 0) { if (iterator.next() == 0) {
iterator.remove(); iterator.remove();
......
...@@ -7,9 +7,9 @@ import java.util.Map.Entry; ...@@ -7,9 +7,9 @@ import java.util.Map.Entry;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
public class ChwHomeComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
...@@ -7,9 +7,9 @@ import java.util.Map.Entry; ...@@ -7,9 +7,9 @@ import java.util.Map.Entry;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
public class ChwWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { public class ChwWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
...@@ -16,7 +16,7 @@ import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; ...@@ -16,7 +16,7 @@ import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test;
import teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test; import teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test;
import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test;
import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceCheckProfileRepository;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
@RunWith(Suite.class) @RunWith(Suite.class)
@SuiteClasses({ @SuiteClasses({
...@@ -42,7 +42,7 @@ public class ComparisonMethodcallWithPorts { ...@@ -42,7 +42,7 @@ public class ComparisonMethodcallWithPorts {
@AfterClass @AfterClass
public static void compareResults() { public static void compareResults() {
ProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class); AbstractProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class);
pcp.check(); pcp.check();
} }
......
...@@ -7,9 +7,9 @@ import java.util.Map.Entry; ...@@ -7,9 +7,9 @@ import java.util.Map.Entry;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
public class NieWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { public class NieWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
...@@ -3,9 +3,9 @@ package teetime.examples.experiment01; ...@@ -3,9 +3,9 @@ package teetime.examples.experiment01;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
...@@ -3,9 +3,9 @@ package teetime.examples.experiment01; ...@@ -3,9 +3,9 @@ package teetime.examples.experiment01;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
...@@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure; ...@@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject; import teetime.util.TimestampObject;
import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceCheckProfileRepository;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
/** /**
* @author Christian Wulf * @author Christian Wulf
...@@ -40,7 +40,7 @@ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest { ...@@ -40,7 +40,7 @@ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest {
@AfterClass @AfterClass
public static void afterClass() { public static void afterClass() {
ProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); AbstractProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class);
performanceCheckProfile.check(); performanceCheckProfile.check();
}; };
......
...@@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; ...@@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test;
import util.test.MeasurementRepository; import util.test.MeasurementRepository;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion {
protected PerformanceResult test01; protected PerformanceResult test01;
protected PerformanceResult test09; protected PerformanceResult test09;
......
...@@ -22,7 +22,7 @@ import org.junit.Test; ...@@ -22,7 +22,7 @@ import org.junit.Test;
import teetime.util.ConstructorClosure; import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject; import teetime.util.TimestampObject;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
/** /**
* @author Christian Wulf * @author Christian Wulf
...@@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { ...@@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest {
@AfterClass @AfterClass
public static void afterClass() { public static void afterClass() {
ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class);
performanceCheckProfile.check(); performanceCheckProfile.check();
}; };
......
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
import teetime.framework.OldHeadPipeline; import teetime.framework.OldHeadPipeline;
import teetime.framework.RunnableStage; import teetime.framework.RunnableStage;
import teetime.framework.Stage; import teetime.framework.IStage;
import teetime.framework.pipe.CommittablePipe; import teetime.framework.pipe.CommittablePipe;
import teetime.stage.CollectorSink; import teetime.stage.CollectorSink;
import teetime.stage.NoopFilter; import teetime.stage.NoopFilter;
...@@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis9 { ...@@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis9 {
private Runnable runnable; private Runnable runnable;
public void init() { public void init() {
Stage pipeline = this.buildPipeline(); IStage pipeline = this.buildPipeline();
this.runnable = new RunnableStage(pipeline); this.runnable = new RunnableStage(pipeline);
} }
......
...@@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; ...@@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test;
import util.test.MeasurementRepository; import util.test.MeasurementRepository;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion {
protected PerformanceResult test01; protected PerformanceResult test01;
protected PerformanceResult test10; protected PerformanceResult test10;
......
...@@ -22,7 +22,7 @@ import org.junit.Test; ...@@ -22,7 +22,7 @@ import org.junit.Test;
import teetime.util.ConstructorClosure; import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject; import teetime.util.TimestampObject;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
/** /**
* @author Christian Wulf * @author Christian Wulf
...@@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest ...@@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest
@AfterClass @AfterClass
public static void afterClass() { public static void afterClass() {
ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class);
performanceCheckProfile.check(); performanceCheckProfile.check();
}; };
......
...@@ -3,9 +3,9 @@ package teetime.examples.experiment11; ...@@ -3,9 +3,9 @@ package teetime.examples.experiment11;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.ProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
......
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