RFR: 8277930: Add unsafe allocation event to jfr [v5]
xpbob
duke at openjdk.java.net
Wed Dec 1 03:08:26 UTC 2021
On Tue, 30 Nov 2021 11:34:12 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> What about overhead (if JFR is disabled)?
>
> This looks like it could be a hot path for some applications.
Thanks
**result:**
|jdk|cores|
|-|-|
|disable jfr(--disable-jvm-feature-jfr)|3.032 ± 0.059|
|remove unsafe event|2.938 ± 0.071|
|unsafe event|2.938 ± 0.065|
**env:**
os: mac os
mem: 16g
cpu:2.6 GHz 6core Intel Core i7
framework:jmh
**testcode:**
@BenchmarkMode(Mode.Throughput)
@Warmup(iterations = 3)
@Measurement(iterations = 10, time = 5, timeUnit = TimeUnit.SECONDS)
@Threads(8)
@Fork(2)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class UnsafeTest {
@Benchmark
public void mallocAndFree() throws Exception {
Field field = Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
Unsafe unsafe = (Unsafe) field.get(null);
for (int i = 0; i < 10000; i++) {
long l = unsafe.allocateMemory(1000);
unsafe.freeMemory(l);
}
}
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/6591
More information about the hotspot-jfr-dev
mailing list