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 3131 <target >${java.version} </target >
3232 </configuration >
3333 </plugin >
34+ <plugin >
35+ <groupId >org.apache.maven.plugins</groupId >
36+ <artifactId >maven-shade-plugin</artifactId >
37+ <version >3.1.0</version >
38+ <executions >
39+ <execution >
40+ <phase >package</phase >
41+ <goals >
42+ <goal >shade</goal >
43+ </goals >
44+ <configuration >
45+ <finalName >benchmarks</finalName >
46+ <transformers >
47+ <transformer implementation =" org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" >
48+ <mainClass >org.openjdk.jmh.Main</mainClass >
49+ </transformer >
50+ </transformers >
51+ <filters >
52+ <filter >
53+ <!--
54+ Shading signed JARs will fail without this.
55+ http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
56+ -->
57+ <artifact >*:*</artifact >
58+ <excludes >
59+ <exclude >META-INF/*.SF</exclude >
60+ <exclude >META-INF/*.DSA</exclude >
61+ <exclude >META-INF/*.RSA</exclude >
62+ </excludes >
63+ </filter >
64+ </filters >
65+ </configuration >
66+ </execution >
67+ </executions >
68+ </plugin >
3469 </plugins >
3570 </build >
3671
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