风一更--软件开发--Java--JMH 微基准测试

目的:使用JMH 对 Java 并行计算科学测试.  2023-02-13


 

1.依赖

2.IDEA 设置

感谢参考:

1.CSDN 博文: https://blog.csdn.net/LiushaoMr/article/details/107729539


 

1. 依赖

<dependency>
    <groupId>org.openjdk.jmh</groupId>
    <artifactId>jmh-core</artifactId>
    <version>1.36</version>
</dependency>

<dependency>
    <groupId>org.openjdk.jmh</groupId>
    <artifactId>jmh-generator-annprocess</artifactId>
    <version>1.36</version>
    <scope>test</scope>
</dependency>
View Code

2.IDEA 

JMH Plugin

由于用到了注解,运行程序注解配置

setting -> Build,Execution,deployment -> Complier -> Annotation Processors -> Enable annotation processing 勾上

3. 测试类要在 test package 下面

4. 如果报错: trying to acquire the JMH lock c:\windows\/jmh.lock 拒绝访问.

RunConfiguration -> Environment Variables -> include system environment viables

 

posted @ 2023-02-13 20:55  君子之行  阅读(18)  评论(0)    收藏  举报