JMH seems like it does most caliper features as well or better than caliper, but I couldn't figure out how to measure allocation rate, which is in general useful to be able to look at in a microbenchmark. Is JMH the wrong tool to measure allocation rate?
How to measure allocation rate with jmh?
Asked Answered
There is no accurate allocation rate measurement in JMH. This is a job for profiler, like Java Mission Control. In JMH, you can roughly estimate the allocation pressure by observing the GC counts via the MXBeans. This is wrapped by JMH profilers, e.g. -prof gc
. Use -lprof
to get the list of embedded profilers.
© 2022 - 2024 — McMap. All rights reserved.
-prof gc
prints allocation rates: mail.openjdk.java.net/pipermail/jmh-dev/2015-April/001828.html – Scald