Skip to content

Commit

Permalink
#203: adds basic jmh infrastructure to project
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Mar 10, 2024
1 parent 3b77a45 commit ab85825
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 39 deletions.
90 changes: 90 additions & 0 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>logorrr</artifactId>
<groupId>app.logorrr</groupId>
<version>${revision}${changelist}</version>
</parent>

<artifactId>benchmarks</artifactId>
<packaging>jar</packaging>

<name>JMH benchmarks for LogoRRR</name>

<dependencies>
<dependency>
<groupId>app.logorrr</groupId>
<artifactId>app</artifactId>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jmh.version>1.37</jmh.version>
<javac.target>1.8</javac.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>benchmarks</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<!--
Shading signed JARs will fail without this.
http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions benchmarks/run-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mvn clean verify; java -jar target/benchmarks.jar
15 changes: 15 additions & 0 deletions benchmarks/src/main/java/app/logorrr/LogoRRRBenchmark.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package app.logorrr;

import org.openjdk.jmh.annotations.*;

@State(Scope.Thread)
@Warmup(iterations = 2, time = 1)
@Measurement(iterations = 3, time = 1)
@Fork(1)
public class LogoRRRBenchmark {

@Benchmark
public void testExample() {
}

}
97 changes: 58 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>app.logorrr</groupId>
<artifactId>logorrr</artifactId>
<version>${revision}${changelist}</version>
<name>app.logorrr</name>
<description>LogoRRR - the log visualisation tool</description>
<packaging>pom</packaging>

<properties>

<!-- make sure you either set following properties here or in your settings xml (preferred) -->

<!--
<jdk.home>/path/to/jdk</jdk.home> (mac, linux, windows)
<graalvm.home>/path/to/graalvm</graalvm.home> (mac, linux, windows)
<osx.jdk.home.aarch64>/path/to/aarch64/jdk</osx.jdk.home.aarch64> (mac)
-->

<jdk.home>/path/to/jdk</jdk.home> (mac, linux, windows)
<graalvm.home>/path/to/graalvm</graalvm.home> (mac, linux, windows)
<osx.jdk.home.aarch64>/path/to/aarch64/jdk</osx.jdk.home.aarch64> (mac)
-->
<revision>24.3.0</revision>

<scala.major.version>2.13</scala.major.version>
<scala.version>${scala.major.version}.12</scala.version>

<openjfx.version>21.0.1</openjfx.version>
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
<ikonli.version>12.3.1</ikonli.version>
<!-- check https://github.com/gluonhq/graal/releases/ for latest gluon graal release -->
<gluonfx.plugin.version>1.0.18</gluonfx.plugin.version>

<!-- no need to change these -->
<changelist>-SNAPSHOT</changelist>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -37,14 +30,13 @@
<graalvm.log>${project.build.directory}/graal.log</graalvm.log>
<jdk.jlink.binary>${jdk.home}/bin/jlink</jdk.jlink.binary>
<jdk.jpackage.binary>${jdk.home}/bin/jpackage</jdk.jpackage.binary>
<jmh.version>1.33</jmh.version>
</properties>

<scm>
<connection>scm:git:https://github.com/rladstaetter/LogoRRR.git</connection>
<developerConnection>scm:git:https://github.com/rladstaetter/LogoRRR.git</developerConnection>
<tag>HEAD</tag>
</scm>

<profiles>
<profile>
<id>OS.windows</id>
Expand All @@ -56,8 +48,8 @@
<properties>
<!-- check https://github.com/gluonhq/graal/releases/ for latest gluon graal release -->
<!-- graalvm builds disabled until https://github.com/rladstaetter/LogoRRR/issues/91
<graalvm.home>C:\Program Files\Java\graalvm-svm-java11-windows-gluon-22.1.0.1-Final</graalvm.home>
-->
<graalvm.home>C:\Program Files\Java\graalvm-svm-java11-windows-gluon-22.1.0.1-Final</graalvm.home>
-->
<!-- see also dist/dist-win/pom.xml! -->
<openjfx.os.prefix>windows</openjfx.os.prefix>
</properties>
Expand Down Expand Up @@ -111,13 +103,13 @@
</message>
</requireProperty>
<!--
<requireProperty>
<property>graalvm.home</property>
<message>You have to set 'graalvm.home' and point to a correct graalvm
installation.
</message>
</requireProperty>
-->
<requireProperty>
<property>graalvm.home</property>
<message>You have to set 'graalvm.home' and point to a correct graalvm
installation.
</message>
</requireProperty>
-->
<requireProperty>
<property>osx.jdk.home.aarch64</property>
<message>You have to set 'osx.jdk.home.aarch64' and it must point to a
Expand Down Expand Up @@ -147,16 +139,20 @@
<module>env</module>
</modules>
</profile>
<profile>
<id>benchmarks</id>
<modules>
<module>benchmarks</module>
</modules>
</profile>
</profiles>

<modules>
<module>core</module>
<module>build</module>
<module>app</module>
<module>dist</module>
<module>docs</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -244,6 +240,17 @@
<artifactId>dist-repackaged</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down Expand Up @@ -321,7 +328,6 @@
<arg>-Werror</arg>
</args>
</configuration>

</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -464,18 +470,18 @@
<configuration>
<rules>
<!-- disable graalvm builds until https://github.com/rladstaetter/LogoRRR/issues/91 is resolved
<requireProperty>
<property>graalvm.home</property>
<message>You have to set 'graalvm.home' and point to a correct graalvm
installation.
</message>
</requireProperty>
<requireFilesExist>
<files>
<file>${graalvm.home}/GRAALVM-README.md</file>
</files>
</requireFilesExist>
-->
<requireProperty>
<property>graalvm.home</property>
<message>You have to set 'graalvm.home' and point to a correct graalvm
installation.
</message>
</requireProperty>
<requireFilesExist>
<files>
<file>${graalvm.home}/GRAALVM-README.md</file>
</files>
</requireFilesExist>
-->
<requireProperty>
<property>jdk.home</property>
<message>You have to set 'jdk.home' and point to a correct jdk
Expand Down Expand Up @@ -520,6 +526,19 @@
<artifactId>download-maven-plugin</artifactId>
<version>1.6.8</version>
</plugin>
<plugin>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-maven-plugin</artifactId>
<version>${jmh.version}</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down

0 comments on commit ab85825

Please sign in to comment.