1 package org.openjdk.bench.vm.gc.barriers.writes;
 2 
 3 import org.openjdk.jmh.annotations.*;
 4 
 5 import java.util.concurrent.TimeUnit;
 6 
 7 @Warmup(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
 8 @Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
 9 @Fork(3)
10 @BenchmarkMode(Mode.AverageTime)
11 @OutputTimeUnit(TimeUnit.NANOSECONDS)
12 @State(Scope.Thread)
13 public class SingleVolatile {
14 
15     static final Target SRC = new Target();
16     Target dst;
17 
18     @Setup
19     public void setup() {
20         dst = new Target();
21     }
22 
23     @Benchmark
24     @CompilerControl(CompilerControl.Mode.DONT_INLINE)
25     public void test() {
26         dst.x1 = SRC;
27     }
28 
29     static class Target {
30         volatile Object x1;
31     }
32 
33 }