Getting the Heap virtual addresses?

Krystal Mok rednaxelafx at gmail.com
Mon Oct 8 14:30:46 UTC 2012


Not much useful reading material on SA other than the source code, which
speaks for itself.
A lot of classes in SA mirror their counterparts in HotSpot's C++ code, so
they're not that hard to understand.

The ones available are:
1. The HotSpot™ Serviceability Agent: An out-of-process high level debugger
for a Java™ virtual machine
http://static.usenix.org/event/jvm01/full_papers/russell/russell_html/
This is an old paper, an overview of the SA.

2. Simple documentation on HotSpot Serviceability
http://openjdk.java.net/groups/hotspot/docs/Serviceability.html

3. The docs in HotSpot's source code, located in hotspot/agent/doc

4. Poonam Bajaj did a presentation on the SA Plugin for VisualVM last year
at JavaOne
https://blogs.oracle.com/poonam/entry/javaone_presentation_on_sa_plugin

- Kris

On Mon, Oct 8, 2012 at 10:08 PM, Eric Caspole <eric.caspole at amd.com> wrote:

> Is there a wiki or anything for Serviceability Agent? That looks useful.
> Thanks,
> Eric
>
>
>
>
> On Oct 6, 2012, at 9:52 AM, Krystal Mok wrote:
>
>  Hi Azeem,
>>
>> (Sorry for the late reply. Just in case someone interested who's not
>> familiar with Serviceability Agent...)
>>
>> The "universe" command in CLHSDB would fit your need perfectly.
>> For example,
>>
>> $ java -cp $JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
>> hsdb> attach 1234
>> Attaching to process 1234, please wait...
>> hsdb> universe
>> ParallelScavengeHeap [ PSYoungGen [ eden =  [0x00000000fd560000,**
>> 0x00000000fedc00a0,**0x00000000ff4c0000] , from =  [0x00000000ff750000,**
>> 0x00000000ff9da020,**0x00000000ff9e0000] , to =  [0x00000000ff4c0000,**
>> 0x00000000ff4c0000,**0x00000000ff750000]  ] PSOldGen [
>>  [0x00000000f8000000,**0x00000000f82eb078,**0x00000000fa9b0000]  ]
>> PSPermGen [ [0x00000000f2e00000,**0x00000000f3970798,**0x00000000f42c0000]
>>  ]  ]
>> hsdb> quit
>> $
>>
>> If you need to programmatically print this information, you could use
>> sun.jvm.hotspot.gc_interface.**CollectedHeap.print().
>> For example,
>>
>> import sun.jvm.hotspot.gc_interface.***;
>> import sun.jvm.hotspot.runtime.*;
>> import sun.jvm.hotspot.tools.*;
>>
>> public class ShowUniverse extends Tool {
>>     public void run() {
>>         CollectedHeap heap = VM.getVM().getUniverse().heap(**);
>>         heap.print();
>>     }
>>
>>     public static void main(String[] args) {
>>         ShowUniverse tool = new ShowUniverse();
>>         tool.start(args);
>>         tool.stop();
>>     }
>> }
>>
>> And used as:
>>
>> $ javac -classpath $JAVA_HOME/lib/sa-jdi.jar ShowUniverse.java
>> $ java -cp .:$JAVA_HOME/lib/sa-jdi.jar ShowUniverse 1234
>> Attaching to process ID 1234, please wait...
>> Debugger attached successfully.
>> Server compiler detected.
>> JVM version is 22.0-b10
>> ParallelScavengeHeap [ PSYoungGen [ eden =  [0x00000000fd560000,**
>> 0x00000000fedc00a0,**0x00000000ff4c0000] , from =  [0x00000000ff750000,**
>> 0x00000000ff9da020,**0x00000000ff9e0000] , to =  [0x00000000ff4c0000,**
>> 0x00000000ff4c0000,**0x00000000ff750000]  ] PSOldGen [
>>  [0x00000000f8000000,**0x00000000f82eb078,**0x00000000fa9b0000]  ]
>> PSPermGen [ [0x00000000f2e00000,**0x00000000f3970798,**0x00000000f42c0000]
>>  ]  ]
>>
>> $
>>
>> If you need to access the individual virtual addresses programmatically,
>> just look at the implementations of CollectedHeap.printOn(**PrintStream
>> tty) in GenCollectedHeap/**ParallelScavengeHeap/**G1CollectedHeap for
>> example.
>>
>> Hope that helps,
>> Kris
>>
>> On Mon, Oct 1, 2012 at 9:10 PM, Azeem Jiva <azeem.jiva at oracle.com> wrote:
>> Krystal,
>>   That would work as well, I just need some way of getting the data while
>> the JVM is running.
>>
>>
>> On 09/30/2012 08:58 PM, Krystal Mok wrote:
>>
>>> Hi Azeem,
>>>
>>> It'd be easy to get with an SA agent instead of a JVMTI agent. Would
>>> that do for you?
>>>
>>> - Kris
>>>
>>> On Sat, Sep 29, 2012 at 2:08 AM, Azeem Jiva <azeem.jiva at oracle.com>
>>> wrote:
>>> Is there a way to get at the virtual addresses for the heap from a JVMTI
>>> agent?  The data is clearly available as PrintGCDetails dumps the
>>> information at the end of the run.
>>>
>>> --
>>> Azeem Jiva
>>> @javawithjiva
>>>
>>>
>>>
>> -- Azeem Jiva @javawithjiva
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20121008/e39222f6/attachment.htm>


More information about the hotspot-gc-dev mailing list