1 package org.openjdk.bench.vm.gc.barriers.reads;
2
3 import org.openjdk.jmh.annotations.*;
4 import org.openjdk.jmh.infra.Blackhole;
5
6 import java.util.concurrent.TimeUnit;
7
8 @Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
9 @Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
10 @Fork(3)
11 @BenchmarkMode(Mode.AverageTime)
12 @OutputTimeUnit(TimeUnit.NANOSECONDS)
13 @State(Scope.Thread)
14 public class IntArray {
15
16 @Param({"1", "1000", "1000000", "1000000000"})
17 private int size;
18
19 int[] src;
20
21 @Setup
22 public void setup() {
23 src = new int[size];
24 }
25
26 @Benchmark
27 @CompilerControl(CompilerControl.Mode.DONT_INLINE)
28 public void plain(Blackhole bh) {
29 for (int t : src) {
30 bh.consume(t);
31 }
32 }
33
34 }