Count metrics with JMH

Dmitry Chuyko dmitry.chuyko at oracle.com
Thu Mar 27 08:54:16 UTC 2014


Hi,

Currently you can use a tricky @AuxCounters state: it can do some 
measurements between iterations or between invokations. There are some 
diagnostic options provided by runtime and particularly by HotSpot. E.g. 
com.sun.management.OperatingSystemMXBean (CPU), 
java.lang.management.MemoryMXBean (memory).
Anyway, the result is quite imprecise except maybe the average CPU usage 
for invocation.
It's better for now to use OS tools for HW counters (perf, sar), while 
it's awaited JMH functionality. The same for process memory stats. And 
some external tool is necessary for java memory info (sampling of 
mxbeans or JFR or whatever), it would be nice to have sampling memory 
profiler in JMH that can cover vm memory counters.

Dmitry

On 03/27/2014 11:45 AM, Aleksey Shipilev wrote:
> On 03/25/2014 09:18 PM, ALex wrote:
>> I can see the number of requests for time, the average time of the test,
>> but do not see the average amount of CPU usage and memory usage. This
>> can be done by means of JMH?
> There are profilers (see -prof), but their functionality is sub-par at
> this point. Anyhow, reporting CPU/memory usage is OS-specific, and so
> may be out of scope for JMH.
>
> -Aleksey.
>



More information about the jmh-dev mailing list