From e8bd469fc53795db83dae3e5c6bc2ab85702e508 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Wed, 17 Dec 2014 07:49:53 +0100 Subject: [PATCH] commented out maven checkstyle plugin; fixed PMD issues --- .checkstyle | 4 + .project | 6 -- .settings/edu.umd.cs.findbugs.core.prefs | 2 +- .settings/org.eclipse.jdt.core.prefs | 87 +++++++++++++++++++ pom.xml | 48 +++++----- .../stage/className/MappingFileParser.java | 9 +- src/main/java/util/KiekerLoadDriver.java | 25 ++++-- .../throughput/ThroughputAnalysisTest.java | 8 +- 8 files changed, 141 insertions(+), 48 deletions(-) diff --git a/.checkstyle b/.checkstyle index e073af44..f8b6ab3d 100644 --- a/.checkstyle +++ b/.checkstyle @@ -4,6 +4,10 @@ <local-check-config name="TeeTime" location="conf/quality-config/cs-conf.xml" type="project" description=""> <additional-data name="protect-config-file" value="false"/> </local-check-config> + <local-check-config name="maven-checkstyle-plugin default" location="file:/C:/Users/chw/Repositories/kieker-teetime-stages/conf/quality-config/cs-conf.xml" type="remote" description="maven-checkstyle-plugin configuration default"> + <property name="checkstyle.cache.file" value="${project_loc}/target/checkstyle-cachefile"/> + <property name="checkstyle.header.file" value="C:\Users\chw\Repositories\kieker-teetime-stages\target\checkstyle-header-default.txt"/> + </local-check-config> <fileset name="all" enabled="true" check-config-name="TeeTime" local="true"> <file-match-pattern match-pattern="." include-pattern="true"/> </fileset> diff --git a/.project b/.project index e847f9b0..fc74064b 100644 --- a/.project +++ b/.project @@ -25,17 +25,11 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature> <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature> - <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> </natures> </projectDescription> diff --git a/.settings/edu.umd.cs.findbugs.core.prefs b/.settings/edu.umd.cs.findbugs.core.prefs index ad260894..0e19b748 100644 --- a/.settings/edu.umd.cs.findbugs.core.prefs +++ b/.settings/edu.umd.cs.findbugs.core.prefs @@ -1,5 +1,5 @@ #FindBugs User Preferences -#Tue Dec 16 13:53:58 CET 2014 +#Wed Dec 17 07:42:45 CET 2014 detector_threshold=3 effort=max excludefilter0=.fbExcludeFilterFile|true diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 01a2d32d..ee85ea23 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,10 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 @@ -7,9 +13,90 @@ org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 diff --git a/pom.xml b/pom.xml index a250e54b..7f0d86d7 100644 --- a/pom.xml +++ b/pom.xml @@ -189,28 +189,28 @@ </plugin> <!-- Checkstyle --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <version>2.12</version> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>check</goal> - </goals> - <configuration> - <configLocation>${basedir}/conf/quality-config/cs-conf.xml</configLocation> - <includeTestSourceDirectory>true</includeTestSourceDirectory> - <encoding>UTF-8</encoding> - <consoleOutput>true</consoleOutput> - <failsOnError>false</failsOnError> - <failOnViolation>false</failOnViolation> - <linkXRef>false</linkXRef> - </configuration> - </execution> - </executions> - </plugin> +<!-- <plugin> --> +<!-- <groupId>org.apache.maven.plugins</groupId> --> +<!-- <artifactId>maven-checkstyle-plugin</artifactId> --> +<!-- <version>2.12</version> --> +<!-- <executions> --> +<!-- <execution> --> +<!-- <phase>test</phase> --> +<!-- <goals> --> +<!-- <goal>check</goal> --> +<!-- </goals> --> +<!-- <configuration> --> +<!-- <configLocation>${project.basedir}/conf/quality-config/cs-conf.xml</configLocation> --> +<!-- <includeTestSourceDirectory>true</includeTestSourceDirectory> --> +<!-- <encoding>UTF-8</encoding> --> +<!-- <consoleOutput>true</consoleOutput> --> +<!-- <failsOnError>false</failsOnError> --> +<!-- <failOnViolation>false</failOnViolation> --> +<!-- <linkXRef>false</linkXRef> --> +<!-- </configuration> --> +<!-- </execution> --> +<!-- </executions> --> +<!-- </plugin> --> <!-- Findbugs --> <plugin> @@ -222,7 +222,7 @@ <threshold>Low</threshold> <includeTests>true</includeTests> <failOnError>false</failOnError> - <excludeFilterFile>${basedir}/conf/quality-config/fb-filter.xml</excludeFilterFile> + <excludeFilterFile>${project.basedir}/conf/quality-config/fb-filter.xml</excludeFilterFile> </configuration> <executions> <execution> @@ -241,7 +241,7 @@ <version>3.2</version> <configuration> <rulesets> - <ruleset>${basedir}/conf/quality-config/pmd-ruleset.xml</ruleset> + <ruleset>${project.basedir}/conf/quality-config/pmd-ruleset.xml</ruleset> </rulesets> <includeTests>true</includeTests> <targetJdk>${java.version}</targetJdk> diff --git a/src/main/java/teetime/stage/className/MappingFileParser.java b/src/main/java/teetime/stage/className/MappingFileParser.java index 93c23df3..0b0df979 100644 --- a/src/main/java/teetime/stage/className/MappingFileParser.java +++ b/src/main/java/teetime/stage/className/MappingFileParser.java @@ -34,13 +34,14 @@ import kieker.common.util.filesystem.FSUtil; */ public class MappingFileParser { + @SuppressWarnings("PMD.LoggerIsNotStaticFinal") protected Logger logger; - private static final Map<String, String> filePrefixRegistry = new HashMap<String, String>(); + private static final Map<String, String> FILE_PREFIX_REGISTRY = new HashMap<String, String>(); static { - filePrefixRegistry.put(FSUtil.MAP_FILENAME, FSUtil.FILE_PREFIX); - filePrefixRegistry.put(FSUtil.LEGACY_MAP_FILENAME, FSUtil.LEGACY_FILE_PREFIX); + FILE_PREFIX_REGISTRY.put(FSUtil.MAP_FILENAME, FSUtil.FILE_PREFIX); + FILE_PREFIX_REGISTRY.put(FSUtil.LEGACY_MAP_FILENAME, FSUtil.LEGACY_FILE_PREFIX); } public MappingFileParser(final Logger logger) { @@ -123,6 +124,6 @@ public class MappingFileParser { * @since 1.10 */ public String getFilePrefixFromMappingFile(final File mappingFile) { - return MappingFileParser.filePrefixRegistry.get(mappingFile.getName()); + return MappingFileParser.FILE_PREFIX_REGISTRY.get(mappingFile.getName()); } } diff --git a/src/main/java/util/KiekerLoadDriver.java b/src/main/java/util/KiekerLoadDriver.java index b689b687..d8d1a25c 100644 --- a/src/main/java/util/KiekerLoadDriver.java +++ b/src/main/java/util/KiekerLoadDriver.java @@ -14,9 +14,12 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; -import teetime.framework.Stage; import teetime.framework.RunnableStage; -import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.Stage; +import teetime.framework.pipe.IPipeFactory; +import teetime.framework.pipe.PipeFactoryRegistry; +import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; +import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; import teetime.stage.CollectorSink; import teetime.stage.InitialElementProducer; import teetime.stage.className.ClassNameRegistryRepository; @@ -33,10 +36,12 @@ public class KiekerLoadDriver { private final List<IMonitoringRecord> elementCollection = new LinkedList<IMonitoringRecord>(); private final RunnableStage runnableStage; private long[] timings; + private final IPipeFactory intraThreadPipeFactory; public KiekerLoadDriver(final File directory) { Stage producerPipeline = this.buildProducerPipeline(directory); - this.runnableStage = new RunnableStage(producerPipeline); + runnableStage = new RunnableStage(producerPipeline); + intraThreadPipeFactory = PipeFactoryRegistry.INSTANCE.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); } private Stage buildProducerPipeline(final File directory) { @@ -46,8 +51,8 @@ public class KiekerLoadDriver { Dir2RecordsFilter dir2RecordsFilter = new Dir2RecordsFilter(classNameRegistryRepository); CollectorSink<IMonitoringRecord> collector = new CollectorSink<IMonitoringRecord>(this.elementCollection); - SingleElementPipe.connect(initialElementProducer.getOutputPort(), dir2RecordsFilter.getInputPort()); - SingleElementPipe.connect(dir2RecordsFilter.getOutputPort(), collector.getInputPort()); + intraThreadPipeFactory.create(initialElementProducer.getOutputPort(), dir2RecordsFilter.getInputPort()); + intraThreadPipeFactory.create(dir2RecordsFilter.getOutputPort(), collector.getInputPort()); return initialElementProducer; } @@ -163,10 +168,12 @@ public class KiekerLoadDriver { recordBuffer.flip(); // System.out.println("position: " + recordBuffer.position()); // System.out.println("limit: " + recordBuffer.limit()); - long start_ns = System.nanoTime(); - int writtenBytes = socketChannel.write(recordBuffer); - long stop_ns = System.nanoTime(); - this.timings[i] = stop_ns - start_ns; + long startTimestampInNs = System.nanoTime(); + + socketChannel.write(recordBuffer); + + long stopTimestampInNs = System.nanoTime(); + this.timings[i] = stopTimestampInNs - startTimestampInNs; if ((i % 100000) == 0) { System.out.println(i); // NOPMD (System.out) } diff --git a/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java b/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java index fa53ff4a..7c5df474 100644 --- a/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java +++ b/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java @@ -33,7 +33,7 @@ import teetime.util.StopWatch; */ public class ThroughputAnalysisTest { - private static final int numRuns = 1000; + private static final int NUM_RUNS = 1000; @Before public void before() { @@ -43,9 +43,9 @@ public class ThroughputAnalysisTest { @Test public void testWithMultipleRuns() throws IllegalStateException, AnalysisConfigurationException { final StopWatch stopWatch = new StopWatch(); - final long[] durations = new long[numRuns]; + final long[] durations = new long[NUM_RUNS]; - for (int i = 0; i < numRuns; i++) { + for (int i = 0; i < NUM_RUNS; i++) { final ThroughputAnalysis<Object> analysis = new ThroughputAnalysis<Object>(); analysis.setNumNoopFilters(100); analysis.setInput(100, new Callable<Object>() { @@ -74,7 +74,7 @@ public class ThroughputAnalysisTest { sum += durations[i]; } - final long avgDur = sum / (numRuns / 2); + final long avgDur = sum / (NUM_RUNS / 2); System.out.println("avg duration: " + (avgDur / 1000) + " �s"); } -- GitLab