< prev index next >
test/micro/org/openjdk/bench/vm/lang/LockUnlock.java
Print this page
rev 53235 : 8216350: AArch64: monitor unlock fast path not called
Reviewed-by: aph, drwhite, fyang
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -28,10 +28,11 @@
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
import java.util.concurrent.TimeUnit;
/**
@@ -114,6 +115,18 @@
return 1;
} else {
return fact(n - 1) * n;
}
}
+
+ /**
+ * With two threads lockObject1 will be contended so should be
+ * inflated.
+ */
+ @Threads(2)
+ @Benchmark
+ public void testContendedLock() {
+ synchronized (lockObject1) {
+ dummyInt1++;
+ }
+ }
}
< prev index next >