Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to measure allocation rate with jmh?

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?

like image 457
nnythm Avatar asked Dec 02 '14 23:12

nnythm


1 Answers

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.

like image 196
Aleksey Shipilev Avatar answered Nov 09 '22 21:11

Aleksey Shipilev