File tree Expand file tree Collapse file tree
src/main/java/ru/javaops/masterjava/matrix Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 <target >${java.version} </target >
3131 </configuration >
3232 </plugin >
33+ <plugin >
34+ <groupId >org.apache.maven.plugins</groupId >
35+ <artifactId >maven-shade-plugin</artifactId >
36+ <version >3.1.0</version >
37+ <executions >
38+ <execution >
39+ <phase >package</phase >
40+ <goals >
41+ <goal >shade</goal >
42+ </goals >
43+ <configuration >
44+ <finalName >benchmarks</finalName >
45+ <transformers >
46+ <transformer implementation =" org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" >
47+ <mainClass >org.openjdk.jmh.Main</mainClass >
48+ </transformer >
49+ </transformers >
50+ <filters >
51+ <filter >
52+ <!--
53+ Shading signed JARs will fail without this.
54+ http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
55+ -->
56+ <artifact >*:*</artifact >
57+ <excludes >
58+ <exclude >META-INF/*.SF</exclude >
59+ <exclude >META-INF/*.DSA</exclude >
60+ <exclude >META-INF/*.RSA</exclude >
61+ </excludes >
62+ </filter >
63+ </filters >
64+ </configuration >
65+ </execution >
66+ </executions >
67+ </plugin >
3368 </plugins >
3469 </build >
3570
Original file line number Diff line number Diff line change 11package ru .javaops .masterjava .matrix ;
22
33import org .openjdk .jmh .annotations .*;
4+ import org .openjdk .jmh .runner .Runner ;
5+ import org .openjdk .jmh .runner .RunnerException ;
6+ import org .openjdk .jmh .runner .options .Options ;
7+ import org .openjdk .jmh .runner .options .OptionsBuilder ;
8+ import org .openjdk .jmh .runner .options .TimeValue ;
49
510import java .util .concurrent .ExecutorService ;
611import java .util .concurrent .Executors ;
@@ -33,6 +38,16 @@ public void setUp() {
3338
3439 private ExecutorService executor ;
3540
41+ public static void main (String [] args ) throws RunnerException {
42+ Options options = new OptionsBuilder ()
43+ .include (MatrixBenchmark .class .getSimpleName ())
44+ .threads (1 )
45+ .forks (10 )
46+ .timeout (TimeValue .minutes (5 ))
47+ .build ();
48+ new Runner (options ).run ();
49+ }
50+
3651 // @Benchmark
3752 public int [][] singleThreadMultiplyOpt () throws Exception {
3853 return MatrixUtil .singleThreadMultiplyOpt (matrixA , matrixB );
You can’t perform that action at this time.
0 commit comments