diff --git a/gocypher-cybench-distribution/pom.xml b/gocypher-cybench-distribution/pom.xml index d617e4e..ec47b27 100644 --- a/gocypher-cybench-distribution/pom.xml +++ b/gocypher-cybench-distribution/pom.xml @@ -130,6 +130,13 @@ ${release.deploy.finalName}-trace-${project.version}.* + + ${release.deploy.dir.mapping} + + ${release.deploy.finalName}-mapping-${project.version}/ + ${release.deploy.finalName}-mapping-${project.version}.* + + @@ -329,6 +336,25 @@ ${release.deploy.finalName}-trace-${project.trace.version} + + security-mapping-deploy + package + + single + + + ${skip.mapping.assembly} + false + + ${release.mapping}/${release.deploy.zip.assembly} + ${release.mapping}/${release.deploy.gz.assembly} + ${release.mapping}/${release.deploy.dir.assembly} + + ${release.deploy.dir.mapping} + ${build.assemblies.attach} + ${release.deploy.finalName}-mapping-${project.version} + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/deployComponentDir.xml b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentDir.xml new file mode 100644 index 0000000..772ac96 --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentDir.xml @@ -0,0 +1,51 @@ + + + + + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.bat + crlf + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.sh + unix + 0777 + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench-launcher.properties + conf + + + ${target.deploy.mapping.jar} + benchmarks/ + + + + + ../ + + CYBENCH_LICENSE* + + + + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/deployComponentUnix.xml b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentUnix.xml new file mode 100644 index 0000000..772ac96 --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentUnix.xml @@ -0,0 +1,51 @@ + + + + + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.bat + crlf + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.sh + unix + 0777 + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench-launcher.properties + conf + + + ${target.deploy.mapping.jar} + benchmarks/ + + + + + ../ + + CYBENCH_LICENSE* + + + + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/deployComponentWin.xml b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentWin.xml new file mode 100644 index 0000000..772ac96 --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/deployComponentWin.xml @@ -0,0 +1,51 @@ + + + + + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.bat + crlf + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench.sh + unix + 0777 + + + ${project.basedir}/../gocypher-cybench-distribution/resources/cybench-launcher.properties + conf + + + ${target.deploy.mapping.jar} + benchmarks/ + + + + + ../ + + CYBENCH_LICENSE* + + + + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/dirDeployAssembly.xml b/gocypher-cybench-distribution/src/assembly-mapping/dirDeployAssembly.xml new file mode 100644 index 0000000..411352b --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/dirDeployAssembly.xml @@ -0,0 +1,33 @@ + + + + + ${project.build.finalName}-dir_deploy + + dir + + false + ${release.deploy.finalName}-mapping + + src/assembly-mapping/deployComponentDir.xml + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/gzDeployAssembly.xml b/gocypher-cybench-distribution/src/assembly-mapping/gzDeployAssembly.xml new file mode 100644 index 0000000..32e9abc --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/gzDeployAssembly.xml @@ -0,0 +1,33 @@ + + + + + ${project.build.finalName}-gz_deploy + + tar.gz + + true + ${release.deploy.finalName}-mapping + + src/assembly-mapping/deployComponentUnix.xml + + diff --git a/gocypher-cybench-distribution/src/assembly-mapping/zipDeployAssembly.xml b/gocypher-cybench-distribution/src/assembly-mapping/zipDeployAssembly.xml new file mode 100644 index 0000000..0e81d31 --- /dev/null +++ b/gocypher-cybench-distribution/src/assembly-mapping/zipDeployAssembly.xml @@ -0,0 +1,33 @@ + + + + + ${project.build.finalName}-zip_deploy + + zip + + true + ${release.deploy.finalName}-mapping + + src/assembly-mapping/deployComponentWin.xml + + diff --git a/gocypher-cybench-mapping/pom.xml b/gocypher-cybench-mapping/pom.xml new file mode 100644 index 0000000..d0506b3 --- /dev/null +++ b/gocypher-cybench-mapping/pom.xml @@ -0,0 +1,157 @@ + + + + 4.0.0 + + + com.gocypher.cybench.client + gocypher-cybench-java-core + 1.0.0 + + + com.gocypher.cybench.client + gocypher-cybench-mapping + 1.0.0 + + + + gocypher-cybench-mapping + + + + + + com.gocypher.cybench.client + gocypher-cybench-runner + 1.0.0 + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${org.slf4j.version} + runtime + + + log4j + log4j + ${log4j.version} + runtime + + + com.gocypher.cybench.client + gocypher-cybench-utils + 1.0.0 + compile + + + org.jctools + jctools-core + 3.3.0 + + + + + clean package + + + ./ + META-INF + + ${license-name} + + + + src/main/resources + ${project.build.directory}/classes + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + ${javac.target} + ${javac.target} + ${javac.target} + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.1 + + + + package + + shade + + + ${jvm.jar.name} + + + *:* + + module-info.class + META-INF/NOTICE* + META-INF/DEPENDENCIES* + LICENSE* + NOTICE* + THIRD-PARTY* + + + + + + + + + + + + maven-clean-plugin + 2.5 + + + maven-deploy-plugin + 2.8.1 + + + maven-install-plugin + 2.5.1 + + + maven-jar-plugin + 2.4 + + + maven-javadoc-plugin + 2.9.1 + + + maven-resources-plugin + 2.6 + + + maven-site-plugin + 3.3 + + + maven-source-plugin + 2.2.1 + + + + + + + + diff --git a/gocypher-cybench-mapping/src/main/java/com/gocypher/cybench/client/MapValueBenchmark.java b/gocypher-cybench-mapping/src/main/java/com/gocypher/cybench/client/MapValueBenchmark.java new file mode 100644 index 0000000..8100029 --- /dev/null +++ b/gocypher-cybench-mapping/src/main/java/com/gocypher/cybench/client/MapValueBenchmark.java @@ -0,0 +1,227 @@ +package com.gocypher.cybench.client; + +import com.gocypher.cybench.core.annotation.BenchmarkMetaData; +import com.gocypher.cybench.jmh.jvm.utils.CyBenchCounters; +import org.jctools.maps.NonBlockingHashMap; +import org.openjdk.jmh.annotations.*; +import java.util.HashMap; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import com.gocypher.cybench.core.annotation.BenchmarkTag; +import org.openjdk.jmh.infra.Blackhole; + +@State(Scope.Benchmark) +@BenchmarkMetaData(key="isLibraryBenchmark", value="true") +@BenchmarkMetaData(key="context", value="mapping") +@BenchmarkMetaData(key="domain", value="java") +@BenchmarkMetaData(key="version", value="1.0.0") +@BenchmarkMetaData(key="libVersion", value="-") +@BenchmarkMetaData(key="libVendor", value="-") +@BenchmarkMetaData(key="api", value="mapping") + + +public class MapValueBenchmark { + + @Param(value = { "INFO", "HALT" }) + OpLevel sev; + + private int begin = 1; + + private double end = 256; + + HashMap levelMap = new HashMap() { + + { + put(OpLevel.NONE, Level.OFF); + put(OpLevel.TRACE, Level.FINER); + put(OpLevel.DEBUG, Level.FINE); + put(OpLevel.INFO, Level.INFO); + put(OpLevel.NOTICE, Level.WARNING); + put(OpLevel.WARNING, Level.WARNING); + put(OpLevel.ERROR, Level.SEVERE); + put(OpLevel.FAILURE, Level.SEVERE); + put(OpLevel.CRITICAL, Level.SEVERE); + put(OpLevel.FATAL, Level.SEVERE); + put(OpLevel.HALT, Level.SEVERE); + } + }; + + TreeMap treeMap = new TreeMap() { + + { + put(OpLevel.NONE, Level.OFF); + put(OpLevel.TRACE, Level.FINER); + put(OpLevel.DEBUG, Level.FINE); + put(OpLevel.INFO, Level.INFO); + put(OpLevel.NOTICE, Level.WARNING); + put(OpLevel.WARNING, Level.WARNING); + put(OpLevel.ERROR, Level.SEVERE); + put(OpLevel.FAILURE, Level.SEVERE); + put(OpLevel.CRITICAL, Level.SEVERE); + put(OpLevel.FATAL, Level.SEVERE); + put(OpLevel.HALT, Level.SEVERE); + } + }; + + ConcurrentHashMap concurentMap = new ConcurrentHashMap() { + + { + put(OpLevel.NONE, Level.OFF); + put(OpLevel.TRACE, Level.FINER); + put(OpLevel.DEBUG, Level.FINE); + put(OpLevel.INFO, Level.INFO); + put(OpLevel.NOTICE, Level.WARNING); + put(OpLevel.WARNING, Level.WARNING); + put(OpLevel.ERROR, Level.SEVERE); + put(OpLevel.FAILURE, Level.SEVERE); + put(OpLevel.CRITICAL, Level.SEVERE); + put(OpLevel.FATAL, Level.SEVERE); + put(OpLevel.HALT, Level.SEVERE); + } + }; + + NonBlockingHashMap nbhm = new NonBlockingHashMap() { + + { + put(OpLevel.NONE, Level.OFF); + put(OpLevel.TRACE, Level.FINER); + put(OpLevel.DEBUG, Level.FINE); + put(OpLevel.INFO, Level.INFO); + put(OpLevel.NOTICE, Level.WARNING); + put(OpLevel.WARNING, Level.WARNING); + put(OpLevel.ERROR, Level.SEVERE); + put(OpLevel.FAILURE, Level.SEVERE); + put(OpLevel.CRITICAL, Level.SEVERE); + put(OpLevel.FATAL, Level.SEVERE); + put(OpLevel.HALT, Level.SEVERE); + } + }; + + Level[] levelMapArray = levelMap.values().toArray(new Level[levelMap.size()]); + + @Benchmark + @BenchmarkTag(tag = "ffe97eb3-c51d-4514-84d3-e4a384d1ea23") + @BenchmarkMetaData(key="libSymbolicName", value="enum") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/8/docs/technotes/guides/language/enums.html") + public void getLevel(Blackhole bh) { + for (int i = begin; i < end; i++) { + switch(sev) { + case INFO: + bh.consume(Level.INFO); + case DEBUG: + bh.consume(Level.FINE); + case TRACE: + bh.consume(Level.FINER); + case NOTICE: + case WARNING: + bh.consume(Level.WARNING); + case ERROR: + case CRITICAL: + case FAILURE: + case FATAL: + case HALT: + bh.consume(Level.SEVERE); + case NONE: + bh.consume(Level.OFF); + default: + bh.consume(Level.INFO); + } + } + } + + @Benchmark + @BenchmarkTag(tag = "c06d47f0-a389-43d8-b392-9f1fabc36c6f") + @BenchmarkMetaData(key="libSymbolicName", value="if_else") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/if.html") + public void getLevelIfElse(Blackhole bh) { + for (int i = begin; i < end; i++) { + if (sev == OpLevel.INFO) { + bh.consume(Level.INFO); + } else if (sev == OpLevel.DEBUG) { + bh.consume(Level.FINE); + } else if (sev == OpLevel.TRACE) { + bh.consume(Level.FINER); + } else if (sev == OpLevel.NOTICE || sev == OpLevel.WARNING) { + bh.consume(Level.WARNING); + } else if (sev == OpLevel.ERROR || sev == OpLevel.CRITICAL || sev == OpLevel.FAILURE || sev == OpLevel.FATAL || sev == OpLevel.HALT) { + bh.consume(Level.SEVERE); + } else if (sev == OpLevel.NONE) { + bh.consume(Level.OFF); + } + bh.consume(Level.INFO); + } + } + + @Benchmark + @BenchmarkTag(tag = "9057176b-c646-497f-b19a-b18d6cd79969") + @BenchmarkMetaData(key="libSymbolicName", value="java.util.HashMap") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html") + public void getLevelFromMap(Blackhole bh) { + for (int i = begin; i < end; i++) { + bh.consume(levelMap.get(sev)); + } + } + + @Benchmark + @BenchmarkTag(tag = "c1be7ae5-bd88-4f26-a73b-28b2a3346e55") + @BenchmarkMetaData(key="libSymbolicName", value="java.util.TreeMap") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html") + public void getLevelFromTreeMap(Blackhole bh) { + for (int i = begin; i < end; i++) { + bh.consume(treeMap.get(sev)); + } + } + + @Benchmark + @BenchmarkTag(tag = "256f72a6-9044-4eb3-b733-cfaa44b9b04f") + @BenchmarkMetaData(key="libSymbolicName", value="array") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html") + public void getLevelFromArray(Blackhole bh) { + for (int i = begin; i < end; i++) { + bh.consume(levelMapArray[sev.ordinal()]); + } + } + + @Benchmark + @BenchmarkTag(tag = "930256ae-eaa0-4f36-b185-cf2642b4d3f0") + @BenchmarkMetaData(key="libSymbolicName", value="array") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html") + public void getLevelFromConcurrentMap(Blackhole bh) { + for (int i = begin; i < end; i++) { + bh.consume(concurentMap.get(sev)); + } + } + + @Benchmark + @BenchmarkTag(tag = "4f3fe091-949f-4c36-851f-e7fd01c22075") + @BenchmarkMetaData(key="libSymbolicName", value="array") + @BenchmarkMetaData(key="libUrl", value="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html") + @BenchmarkMetaData(key="libVersion", value="3.3.0") + @BenchmarkMetaData(key="libVendor", value="JCTools") + public void getLevelFromNonBlockingHashMap(Blackhole bh) { + for (int i = begin; i < end; i++) { + bh.consume(nbhm.get(sev)); + } + } + + public enum OpLevel { + + NONE, + TRACE, + DEBUG, + INFO, + NOTICE, + WARNING, + ERROR, + FAILURE, + CRITICAL, + FATAL, + HALT + } + + @TearDown(org.openjdk.jmh.annotations.Level.Iteration) + public void clearIteration(CyBenchCounters.ProfileCounters counters) { + CyBenchCounters.registerProfileInformation(counters); + } +} diff --git a/gocypher-cybench-mapping/src/pomUpdates/distributionExecution b/gocypher-cybench-mapping/src/pomUpdates/distributionExecution new file mode 100644 index 0000000..3e66f78 --- /dev/null +++ b/gocypher-cybench-mapping/src/pomUpdates/distributionExecution @@ -0,0 +1,19 @@ + + security-mapping-deploy + package + + single + + + ${skip.mapping.assembly} + false + + ${release.mapping}/${release.deploy.zip.assembly} + ${release.mapping}/${release.deploy.gz.assembly} + ${release.mapping}/${release.deploy.dir.assembly} + + ${release.deploy.dir.mapping} + ${build.assemblies.attach} + ${release.deploy.finalName}-mapping-${project.version} + + diff --git a/gocypher-cybench-mapping/src/pomUpdates/distributionFilesets b/gocypher-cybench-mapping/src/pomUpdates/distributionFilesets new file mode 100644 index 0000000..1687828 --- /dev/null +++ b/gocypher-cybench-mapping/src/pomUpdates/distributionFilesets @@ -0,0 +1,7 @@ + + ${release.deploy.dir.mapping} + + ${release.deploy.finalName}-mapping-${project.version}/ + ${release.deploy.finalName}-mapping-${project.version}.* + + diff --git a/gocypher-cybench-mapping/src/pomUpdates/rootProfiles b/gocypher-cybench-mapping/src/pomUpdates/rootProfiles new file mode 100644 index 0000000..2249e00 --- /dev/null +++ b/gocypher-cybench-mapping/src/pomUpdates/rootProfiles @@ -0,0 +1,9 @@ + + pack-jvm-mapping + + false + + + gocypher-cybench-mapping + + diff --git a/gocypher-cybench-mapping/src/pomUpdates/rootProperties b/gocypher-cybench-mapping/src/pomUpdates/rootProperties new file mode 100644 index 0000000..8c18a34 --- /dev/null +++ b/gocypher-cybench-mapping/src/pomUpdates/rootProperties @@ -0,0 +1,6 @@ + src/assembly-mapping + ../gocypher-cybench-mapping/target/gocypher-cybench-mapping.jar + ../deploy/mapping + + 1.0.0 + true \ No newline at end of file diff --git a/pom.xml b/pom.xml index e7cc181..562d532 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,6 @@ 2.11.2 1.2.17 1.7.30 - true @@ -66,70 +65,68 @@ 1.0.1 ../gocypher-cybench-string/target/gocypher-cybench-string.jar ../deploy/string - true src/assembly-json 1.0.1 ../gocypher-cybench-json/target/gocypher-cybench-json.jar ../deploy/json - true src/assembly-io 1.0.1 ../gocypher-cybench-io/target/gocypher-cybench-io.jar ../deploy/io - src/assembly-list true 1.0.1 ../gocypher-cybench-list/target/gocypher-cybench-list.jar ../deploy/list - true src/assembly-number 1.0.1 ../gocypher-cybench-number/target/gocypher-cybench-number.jar ../deploy/number - true src/assembly-matrices 1.0.1 ../gocypher-cybench-matrices/target/gocypher-cybench-matrices.jar ../deploy/matrices - true src/assembly-httpServers 1.0.1 ../gocypher-cybench-httpServers/target/gocypher-cybench-httpServers.jar ../deploy/httpServers - true src/assembly-security-crypto 1.0.1 ../gocypher-cybench-security-crypto/target/gocypher-cybench-security-crypto.jar ../deploy/security-crypto - true src/assembly-securityRSA 1.0.1 ../gocypher-cybench-securityRSA/target/gocypher-cybench-securityRSA.jar ../deploy/securityRSA - true src/assembly-trace 1.0.1 ../gocypher-cybench-trace/target/gocypher-cybench-trace.jar ../deploy/trace - + + + src/assembly-mapping + ../gocypher-cybench-mapping/target/gocypher-cybench-mapping.jar + ../deploy/mapping + 1.0.1 + true + @@ -222,6 +219,15 @@ gocypher-cybench-trace + + pack-jvm-mapping + + false + + + gocypher-cybench-mapping + + x-distribution