@@ -78,31 +78,47 @@ subprojects {
7878 }
7979 }
8080
81+ /**
82+ * By default: Run without arguments this will execute all benchmarks that are found (can take a long time).
83+ *
84+ * Optionally pass arguments for custom execution. Example:
85+ *
86+ * ../gradlew benchmarks '-Pjmh=-f 1 -tu ns -bm avgt -wi 5 -i 5 -r 1 .*OperatorSerializePerf.*'
87+ *
88+ * To see all options:
89+ *
90+ * ../gradlew benchmarks '-Pjmh=-h'
91+ */
8192 task benchmarks(type : JavaExec ) {
8293 main = ' org.openjdk.jmh.Main'
8394 classpath = sourceSets. perf. runtimeClasspath + sourceSets. main. output
8495 maxHeapSize = " 512m"
85- // args '-h' // help output
86- args ' -f' // fork
87- args ' 1'
88- args ' -tu' // time unit
89- args ' ns'
90- args ' -bm' // benchmark mode
91- args ' avgt'
92- args ' -wi' // warmup iterations
93- args ' 5'
94- args ' -i' // test iterations
95- args ' 5'
96- args ' -r' // time per execution in seconds
97- args ' 1'
98- // args '-prof' // profilers
99- // args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
100- // args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
101- // args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
102- // args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
103- // args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
104- // args 'STACK' // Simple and naive Java stack profiler
105- // args '.*OperatorSerializePerf.*' // for running only a specific test
96+
97+ if (project. hasProperty(' jmh' )) {
98+ args(jmh. split(' ' ))
99+ } else {
100+ // args '-h' // help output
101+ args ' -f' // fork
102+ args ' 1'
103+ args ' -tu' // time unit
104+ args ' ns'
105+ args ' -bm' // benchmark mode
106+ args ' avgt'
107+ args ' -wi' // warmup iterations
108+ args ' 5'
109+ args ' -i' // test iterations
110+ args ' 5'
111+ args ' -r' // time per execution in seconds
112+ args ' 5'
113+ // args '-prof' // profilers
114+ // args 'HS_GC' // HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
115+ // args 'HS_RT' // HotSpot (tm) runtime profiling via implementation-specific MBeans
116+ // args 'HS_THR' // HotSpot (tm) threading subsystem via implementation-specific MBeans
117+ // args 'HS_COMP' // HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
118+ // args 'HS_CL' // HotSpot (tm) classloader profiling via implementation-specific MBeans
119+ // args 'STACK' // Simple and naive Java stack profiler
120+ args ' .*OperatorSerializePerf.*' // for running only a specific test
121+ }
106122 }
107123
108124}
0 commit comments