File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
javase-jvm/src/main/java/cn/edu/ntu/javase/jvm Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ ## jmh
2+
3+ 1 . @WarmUp (iterations=1, time=3)
4+ - 预热, 由于存在本地优化, 所以预热很重要: 多次执行 JIT 会优化的
5+ 2 . @Measurement (iterations=1, time=3)
6+ - 总共执行多少次测试
7+ 3 . @Timeout
8+ 4 . @Fork
9+ - 线程数
10+ 5 . @BenchmarkMode (Mode.Throughput)
11+ - 基准测试的模式
12+ - Throughput: 每秒吞吐量
13+ 6 . @Benchmark
14+ - 测试的代码段
Original file line number Diff line number Diff line change 99import java .util .ArrayList ;
1010import java .util .HashMap ;
1111import java .util .Map ;
12+ import java .util .concurrent .atomic .AtomicLong ;
1213import java .util .stream .IntStream ;
1314
1415/**
@@ -66,6 +67,12 @@ public void testObject() {
6667 log .info (ClassLayout .parseInstance (o ).toPrintable ());
6768 }
6869
70+ @ Test
71+ public void testAtomicLong () {
72+ AtomicLong o = new AtomicLong ();
73+ log .info (ClassLayout .parseInstance (o ).toPrintable ());
74+ }
75+
6976 @ Test
7077 public void testPaddedAtomicLong () {
7178 PaddedAtomicLong o = new PaddedAtomicLong ();
You can’t perform that action at this time.
0 commit comments