Class histogram in HS_GC profiler

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Dec 4 12:45:06 PST 2013


On 12/05/2013 12:00 AM, Ron Pressler wrote:
> I’ve enabled some JMH profilers. They are extremely useful! Would it 
> be possible to add a class histogram in the HS-GC profiler?

Why not? Would you like to have some hacking done? We can accept your
patch as followed by usual OpenJDK contribution policies here (see point
"0"):  http://openjdk.java.net/contribute/

It is rather easy to wind up new profiler or fix existing one.

> I looked at the VisualVM code to see how VisualVM does GC sampling.
> VisualVM uses several methods: jvmstat, com.sun.attach, or JMX. It
> seems like JMX is the simplest approach.

JMX is also preferred since it can be used from within the JVM. Attach
only works from "outside".

> The code for a JMX class histogram is in the takeHeapHistogram() 
> method in this file. The returned String is parsed here. Would it be 
> possible to add class histogram info to the HS-GC profiler?

These URLs got stripped:
 https://java.net/projects/visualvm/sources/svn/content/trunk/visualvm/jmx/src/com/sun/tools/visualvm/jmx/impl/JmxSupport.java?rev=3310
 https://java.net/projects/visualvm/sources/svn/content/trunk/visualvm/jmx/src/com/sun/tools/visualvm/jmx/impl/HeapHistogramImpl.java?rev=3310


-Aleksey.



More information about the jmh-dev mailing list