This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git


The following commit(s) were added to refs/heads/main by this push:
     new aca6ca0  Modified the AccessExpressionBenchmark to enable JFR (#110)
aca6ca0 is described below

commit aca6ca01e0a48e41efbb9692288d6da7b5128258
Author: Dave Marion <[email protected]>
AuthorDate: Wed Mar 11 16:16:37 2026 -0400

    Modified the AccessExpressionBenchmark to enable JFR (#110)
    
    Added properties to the core pom.xml that can be
    overridden on the command line to filter which
    benchmark methods to run and to enable Java
    Flight Recorder during the benchmark run.
---
 modules/core/pom.xml                                   |  8 ++++++++
 .../access/tests/AccessExpressionBenchmark.java        | 18 +++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 0e4a926..9693339 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -28,6 +28,10 @@
     <relativePath>../../pom.xml</relativePath>
   </parent>
   <artifactId>accumulo-access-core</artifactId>
+  <properties>
+    <benchmark.jfr>false</benchmark.jfr>
+    <benchmark.methods>.*</benchmark.methods>
+  </properties>
   <dependencies>
     <dependency>
       <groupId>com.github.spotbugs</groupId>
@@ -114,6 +118,10 @@
                     <classpath />
                     
<argument>org.apache.accumulo.access.tests.AccessExpressionBenchmark</argument>
                   </arguments>
+                  <environmentVariables>
+                    <ENABLE_JFR>${benchmark.jfr}</ENABLE_JFR>
+                    <ACCESS_BENCHMARK>${benchmark.methods}</ACCESS_BENCHMARK>
+                  </environmentVariables>
                 </configuration>
               </execution>
             </executions>
diff --git 
a/modules/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
 
b/modules/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
index a5eb3b4..e153de9 100644
--- 
a/modules/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
+++ 
b/modules/core/src/test/java/org/apache/accumulo/access/tests/AccessExpressionBenchmark.java
@@ -39,9 +39,10 @@ import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.profile.JavaFlightRecorderProfiler;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.RunnerException;
-import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
 import org.openjdk.jmh.runner.options.TimeValue;
 
@@ -258,10 +259,17 @@ public class AccessExpressionBenchmark {
     var include = System.getenv().getOrDefault("ACCESS_BENCHMARK",
         AccessExpressionBenchmark.class.getSimpleName());
 
-    Options opt = new OptionsBuilder().include(include).mode(Mode.Throughput)
+    var jfr = Boolean.parseBoolean(System.getenv().getOrDefault("ENABLE_JFR", 
"false"));
+
+    ChainedOptionsBuilder builder = new 
OptionsBuilder().include(include).mode(Mode.Throughput)
         
.operationsPerInvocation(numExpressions).timeUnit(TimeUnit.MICROSECONDS)
-        
.warmupTime(TimeValue.seconds(5)).warmupIterations(3).measurementIterations(4).forks(3)
-        .build();
-    new Runner(opt).run();
+        
.warmupTime(TimeValue.seconds(5)).warmupIterations(3).measurementIterations(4).forks(3);
+
+    if (jfr) {
+      builder.addProfiler(JavaFlightRecorderProfiler.class,
+          "dir=" + System.getProperty("java.io.tmpdir"));
+    }
+
+    new Runner(builder.build()).run();
   }
 }

Reply via email to