How to measure allocation rate with jmh?
Asked Answered
I

1

8

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?

Inandin answered 2/12, 2014 at 23:2 Comment(0)
B
12

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.

Binal answered 3/12, 2014 at 19:15 Comment(1)
As of jmh 1.9 -prof gc prints allocation rates: mail.openjdk.java.net/pipermail/jmh-dev/2015-April/001828.htmlScald

© 2022 - 2024 — McMap. All rights reserved.