Mit Debugger interne HotSpot JVM Informationen auslesen in Java 7

Hallo,

Tool PMap -> Listet die von dem Java Prozess geladenen nativen Bibliotheken (z.Bsp.: Windows Dlls) auf:
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.PMap
Usage: java sun.jvm.hotspot.tools.PMap [option] <pid>
                (to connect to a live java process)
   or java sun.jvm.hotspot.tools.PMap [option] <executable> <core>
                (to connect to a core file)
   or java sun.jvm.hotspot.tools.PMap [option] [server_id@]<remote server IP or hostname>
                (to connect to a remote debug server)

where option must be one of:
    -h | -help  to print this help message

C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.PMap 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
0x0000000063bc0000      7272K   C:\Program Files\Java\jdk1.7.0_04\jre\bin\server\jvm.dll
0x000000006d1e0000      1616K   C:\Program Files\Java\jdk1.7.0_04\jre\bin\awt.dll
0x000000006e740000      260K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\t2k.dll
0x00000000730e0000      208K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\fontmanager.dll
0x0000000073120000      68K     C:\Program Files\Java\jdk1.7.0_04\jre\bin\nio.dll
0x0000000073140000      252K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\splashscreen.dll
0x0000000073180000      836K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\msvcr100.dll
0x0000000073410000      100K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\net.dll
0x0000000074920000      160K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\java.dll
0x0000000074960000      84K     C:\Program Files\Java\jdk1.7.0_04\jre\bin\zip.dll
0x00000000749a0000      36K     C:\Program Files\Java\jdk1.7.0_04\jre\bin\attach.dll
0x00000000749b0000      60K     C:\Program Files\Java\jdk1.7.0_04\jre\bin\verify.dll
0x0000000074af0000      44K     C:\Program Files\Java\jdk1.7.0_04\jre\bin\management.dll
0x0000000076ba0000      1000K   C:\Windows\system32\USER32.dll
0x0000000076f50000      1148K   C:\Windows\system32\kernel32.dll
0x0000000077280000      1700K   C:\Windows\SYSTEM32\ntdll.dll
0x0000000077440000      28K     C:\Windows\system32\PSAPI.DLL
0x000000013ffb0000      204K    C:\Program Files\Java\jdk1.7.0_04\jre\bin\java.exe
0x000007feef5f0000      640K    C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_a4d6a923711520a9\comctl32.dll
0x000007fef6e50000      60K     C:\Windows\system32\CSCAPI.dll
0x000007fef6fb0000      512K    C:\Windows\system32\ntshrui.dll
0x000007fef7180000      48K     C:\Windows\System32\CSCDLL.dll
0x000007fef7190000      504K    C:\Windows\System32\cscui.dll
0x000007fef7210000      212K    C:\Windows\system32\EhStorShell.dll
0x000007fef7b40000      44K     C:\Windows\System32\winrnr.dll
0x000007fef7f20000      100K    C:\Windows\system32\pnrpnsp.dll
0x000007fef7f40000      84K     C:\Windows\system32\napinsp.dll
0x000007fef8a40000      32K     C:\Windows\system32\rasadhlp.dll
0x000007fefa0c0000      96K     C:\Windows\system32\dhcpcsvc.DLL
0x000007fefa0e0000      68K     C:\Windows\system32\dhcpcsvc6.DLL
0x000007fefa150000      332K    C:\Windows\System32\fwpuclnt.dll
0x000007fefacd0000      1192K   C:\Windows\system32\WindowsCodecs.dll
0x000007fefb1f0000      96K     C:\Windows\system32\DWMAPI.DLL
0x000007fefb320000      236K    C:\Windows\system32\WINMM.dll
0x000007fefbc40000      2000K   C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll
0x000007fefc180000      84K     C:\Windows\system32\NLAapi.dll
0x000007fefc1e0000      1200K   C:\Windows\system32\PROPSYS.dll
0x000007fefc6d0000      28K     C:\Windows\System32\wshtcpip.dll
0x000007fefcaf0000      364K    C:\Windows\system32\DNSAPI.dll
0x000007fefcc00000      28K     C:\Windows\System32\wship6.dll
0x000007fefcc10000      284K    C:\Windows\system32\rsaenh.dll
0x000007fefccc0000      340K    C:\Windows\system32\mswsock.dll
0x000007fefcf10000      92K     C:\Windows\system32\CRYPTSP.dll
0x000007fefd2f0000      348K    C:\Windows\system32\apphelp.dll
0x000007fefd350000      60K     C:\Windows\system32\CRYPTBASE.dll
0x000007fefd420000      44K     C:\Windows\system32\slc.dll
0x000007fefd430000      44K     C:\Windows\system32\WINNSI.DLL
0x000007fefd440000      156K    C:\Windows\system32\IPHLPAPI.DLL
0x000007fefd470000      36K     C:\Windows\system32\WSOCK32.dll
0x000007fefd5b0000      60K     C:\Windows\system32\profapi.dll
0x000007fefd5c0000      120K    C:\Windows\system32\USERENV.dll
0x000007fefd670000      140K    C:\Windows\system32\srvcli.dll
0x000007fefd900000      216K    C:\Windows\system32\CFGMGR32.dll
0x000007fefd940000      104K    C:\Windows\system32\DEVOBJ.dll
0x000007fefda40000      432K    C:\Windows\system32\KERNELBASE.dll
0x000007fefdab0000      13856K  C:\Windows\system32\SHELL32.dll
0x000007fefe840000      124K    C:\Windows\SYSTEM32\sechost.dll
0x000007fefe860000      32K     C:\Windows\system32\NSI.dll
0x000007fefe870000      2060K   C:\Windows\system32\ole32.dll
0x000007fefea80000      412K    C:\Windows\system32\GDI32.dll
0x000007fefeaf0000      1060K   C:\Windows\system32\MSCTF.dll
0x000007fefecc0000      184K    C:\Windows\system32\IMM32.DLL
0x000007fefecf0000      56K     C:\Windows\system32\LPK.dll
0x000007fefed00000      308K    C:\Windows\system32\WS2_32.dll
0x000007fefed50000      876K    C:\Windows\system32\ADVAPI32.dll
0x000007fefee30000      1884K   C:\Windows\system32\SETUPAPI.dll
0x000007feff010000      636K    C:\Windows\system32\msvcrt.dll
0x000007feff0b0000      1204K   C:\Windows\system32\RPCRT4.dll
0x000007feff1e0000      452K    C:\Windows\system32\SHLWAPI.dll
0x000007feff260000      804K    C:\Windows\system32\USP10.dll
0x000007feff330000      860K    C:\Windows\system32\OLEAUT32.DLL
0x000007feff4f0000      612K    C:\Windows\system32\CLBCatQ.DLL

C:\Users\tom>

Gruß Tom
 
Hallo,

Tool ObjectHistogram -> Berechnet ein ObjektHistogram auf Basis eines HeapSnapshots (da braucht man ja fast kein JVisualVM mehr *g*)
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.ObjectHistogram
Usage: java sun.jvm.hotspot.tools.ObjectHistogram [option] <pid>
                (to connect to a live java process)
   or java sun.jvm.hotspot.tools.ObjectHistogram [option] <executable> <core>
                (to connect to a core file)
   or java sun.jvm.hotspot.tools.ObjectHistogram [option] [server_id@]<remote server IP or hostname>
                (to connect to a remote debug server)

where option must be one of:
    -h | -help  to print this help message

C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.ObjectHistogram 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
Iterating over heap. This may take a while...
none
null_check
null_assert
range_check
class_check
array_check
intrinsic
bimorphic
unloaded
uninitialized
unreached
unhandled
constraint
div0_check
age
predicate
loop_limit_check
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Object Histogram:

num       #instances    #bytes  Class description
--------------------------------------------------------------------------
1:              65557   8960024 * ConstMethodKlass
2:              65557   8931976 * MethodKlass
3:              6066    7273152 * ConstantPoolKlass
4:              56325   6240096 char[]
5:              6066    6002792 * InstanceKlassKlass
6:              9177    5385896 int[]
7:              5411    4622496 * ConstantPoolCacheKlass
8:              14708   1945544 byte[]
9:              54295   1737440 java.lang.String
10:             6491    787704  java.lang.Class
11:             23036   737152  java.util.HashMap$Entry
12:             1466    734776  * MethodDataKlass
13:             10035   648200  short[]
14:             12337   617496  java.lang.Object[]
15:             5693    520752  java.util.HashMap$Entry[]
16:             9654    500368  * System ObjArray
17:             4924    393920  java.lang.reflect.Method
18:             11594   371008  java.util.Hashtable$Entry
19:             5595    268560  java.util.HashMap
20:             6461    258440  java.util.TreeMap$Entry
21:             408     235008  * ObjArrayKlassKlass
22:             5426    217040  java.util.LinkedHashMap$Entry
23:             572     134064  long[]
24:             5519    132456  java.util.ArrayList
25:             1073    129536  java.util.Hashtable$Entry[]
26:             2516    120768  java.security.ProtectionDomain[]
27:             4849    116376  java.lang.Double
28:             6986    111776  java.lang.Object
29:             3389    108448  java.lang.ref.WeakReference
30:             1933    108248  java.nio.DirectLongBufferU
31:             2688    107520  java.util.WeakHashMap$Entry
32:             3231    103392  java.util.concurrent.ConcurrentHashMap$HashEntry
33:             4862    103304  java.lang.Class[]
34:             277     95288   javax.swing.JPanel
35:             2170    93360   java.lang.String[]
36:             1203    86616   java.lang.reflect.Field
37:             2696    86272   java.util.TreeMap$KeyIterator
38:             2087    83480   java.lang.ref.Finalizer
39:             2486    79552   javax.swing.text.html.parser.ContentModel
40:             2485    79520   java.security.AccessControlContext
41:             1927    77080   sun.jvmstat.perfdata.monitor.PerfLongMonitor
42:             140     68320   com.sun.java.swing.plaf.windows.WindowsScrollBarUI$WindowsArrowButton
43:             1207    67592   java.util.zip.ZipFile$ZipFileInputStream
44:             1331    63888   org.openide.util.RequestProcessor$FastItem
45:             1510    60400   java.lang.ref.SoftReference
46:             1258    60384   org.openide.util.RequestProcessor$EnqueueTask
47:             3010    48160   javax.swing.event.EventListenerList
48:             369     47488   java.util.WeakHashMap$Entry[]
49:             959     46032   java.util.Hashtable
50:             1675    40200   java.lang.StringBuilder
51:             558     40176   java.lang.reflect.Constructor
52:             1630    39120   java.lang.Long
53:             2357    37712   java.lang.Integer
54:             575     36800   org.openide.filesystems.MultiFileObject
55:             2223    35568   java.util.HashSet
56:             1477    35448   java.util.jar.Attributes$Name
57:             347     33312   java.lang.management.ThreadInfo
58:             679     32592   org.netbeans.lib.profiler.charts.swing.LongRect
59:             978     31296   java.awt.Rectangle
60:             491     30400   java.util.concurrent.ConcurrentHashMap$HashEntry[]
61:             564     30352   java.lang.reflect.Method[]
62:             472     30208   java.awt.event.InvocationEvent
63:             1232    30064   java.beans.PropertyChangeListener[]
64:             340     29920   javax.swing.text.html.InlineView
65:             74      29008   javax.swing.JLabel
66:             895     28640   javax.swing.text.html.StyleSheet$SmallConversionSet
67:             893     28576   java.util.concurrent.locks.ReentrantLock$NonfairSync
68:             853     27296   javax.swing.SizeRequirements
69:             680     27200   javax.swing.text.GapContent$MarkData
70:             1121    26904   java.beans.PropertyChangeSupport
71:             836     26752   org.openide.util.WeakListenerImpl$ListenerReference
72:             825     26400   org.openide.modules.Dependency
73:             1064    25536   java.awt.AWTEventMulticaster
74:             786     25152   java.util.Vector
75:             392     25088   java.nio.DirectByteBuffer
76:             390     24960   org.netbeans.core.startup.layers.BinaryFS$BFSFile
77:             66      24816   javax.swing.JScrollPane$ScrollBar
78:             516     24768   java.util.TreeMap
79:             503     24144   java.util.logging.LogManager$LoggerWeakRef
80:             945     23320   javax.swing.text.AttributeSet[]
81:             362     23168   java.net.URL
82:             553     22120   javax.swing.text.html.HTMLDocument$RunElement
83:             395     22120   java.awt.BorderLayout
84:             671     21472   org.openide.util.WeakListenerImpl$ProxyListener
85:             45      21240   com.sun.tools.visualvm.core.ui.components.DisplayAreaSupport$ImageIconButton
86:             875     21000   java.util.Collections$UnmodifiableCollection$1
87:             184     19136   sun.awt.image.IntegerInterleavedRaster
88:             475     19000   java.util.concurrent.ConcurrentHashMap$Segment
89:             1171    18736   java.util.HashMap$KeySet
90:             1168    18688   java.beans.PropertyChangeSupport$PropertyChangeListenerMap
91:             84      18336   float[]
92:             758     18192   java.lang.StringBuffer
93:             362     17376   java.util.WeakHashMap
94:             37      17168   com.sun.tools.visualvm.core.ui.components.DisplayAreaSupport$TabButton
95:             36      16992   com.sun.tools.visualvm.core.ui.components.DisplayArea$Presenter
96:             45      16920   com.sun.tools.visualvm.core.ui.components.DisplayArea
97:             679     16296   javax.swing.text.html.StyleSheet$ViewAttributeSet
98:             45      16200   com.sun.tools.visualvm.core.ui.components.DisplayArea$OptionsContainer
99:             45      15840   com.sun.tools.visualvm.core.ui.components.DisplayArea$TabsContainer
100:            658     15792   javax.swing.ActionMap
101:            45      15480   com.sun.tools.visualvm.core.ui.components.DisplayArea$MiddleSpacer
102:            45      15480   com.sun.tools.visualvm.core.ui.components.DisplayArea$ViewArea
103:            241     15424   java.util.logging.Logger
104:            41      15416   javax.swing.JViewport
105:            320     15360   javax.swing.text.html.HTMLDocument$BlockElement
106:            627     15048   javax.swing.text.GapContent$StickyPosition
107:            268     15008   java.text.Format[]
108:            464     14848   sun.font.TrueTypeFont$DirectoryEntry
109:            457     14624   java.lang.ref.ReferenceQueue
110:            594     14256   javax.swing.InputMap

Gruß Tom
 
Hallo,

Tool JStack: Listet eine kompakte Darstellung der Java StackTraces aller Threads auf.
(gleiche Ausgabe wie %JAVA_HOME%\bin\jstack nur kompakter)
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.JStack
Usage: jstack [option] <pid>
                (to connect to a live java process)
   or jstack [option] <executable> <core>
                (to connect to a core file)
   or jstack [option] [server_id@]<remote server IP or hostname>
                (to connect to a remote debug server)

where option must be one of:
    -l  to print java.util.concurrent locks
    -m  to print both java and native frames (mixed mode)
    -h | -help  to print this help message

C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.JStack 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
Deadlock Detection:

No deadlocks found.

Thread 36: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - org.openide.util.RequestProcessor$Processor.run() @bci=23, line=1880 (Interpreted frame)


Thread 35: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - org.openide.util.RequestProcessor$Processor.run() @bci=23, line=1880 (Interpreted frame)


Thread 34: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - org.openide.util.RequestProcessor$Processor.run() @bci=23, line=1880 (Interpreted frame)


Thread 32: (state = BLOCKED)
 - sun.misc.Unsafe.park(boolean, long) @bci=0 (Interpreted frame)
 - java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=186 (Interpreted frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2043 (Interpreted frame)
 - java.util.concurrent.LinkedBlockingQueue.take() @bci=29, line=442 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor.getTask() @bci=156, line=1043 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=17, line=1103 (Interpreted frame)
 - java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=603 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 31: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.util.TimerThread.mainLoop() @bci=201, line=552 (Interpreted frame)
 - java.util.TimerThread.run() @bci=1, line=505 (Interpreted frame)


Thread 30: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - org.openide.util.RequestProcessor$Processor.run() @bci=23, line=1880 (Interpreted frame)


Thread 1: (state = BLOCKED)


Thread 29: (state = BLOCKED)
 - sun.misc.Unsafe.park(boolean, long) @bci=0 (Interpreted frame)
 - java.util.concurrent.locks.LockSupport.parkNanos(java.lang.Object, long) @bci=20, line=226 (Interpreted frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(long) @bci=68, line=2082 (Interpreted frame)
 - java.util.concurrent.DelayQueue.take() @bci=132, line=220 (Interpreted frame)
 - javax.swing.TimerQueue.run() @bci=20, line=171 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 28: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.util.prefs.AbstractPreferences$EventDispatchThread.run() @bci=22, line=1476 (Interpreted frame)


Thread 27: (state = BLOCKED)
 - sun.misc.Unsafe.park(boolean, long) @bci=0 (Interpreted frame)
 - java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=186 (Interpreted frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await() @bci=42, line=2043 (Interpreted frame)
 - java.awt.EventQueue.getNextEvent() @bci=48, line=511 (Interpreted frame)
 - java.awt.EventDispatchThread.pumpOneEventForFilters(int) @bci=51, line=213 (Compiled frame)
 - java.awt.EventDispatchThread.pumpEventsForFilter(int, java.awt.Conditional, java.awt.EventFilter) @bci=48, line=163 (Interpreted frame)
 - java.awt.EventDispatchThread.pumpEventsForHierarchy(int, java.awt.Conditional, java.awt.Component) @bci=11, line=151 (Interpreted frame)
 - java.awt.EventDispatchThread.pumpEvents(int, java.awt.Conditional) @bci=4, line=147 (Interpreted frame)
 - java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional) @bci=3, line=139 (Interpreted frame)
 - java.awt.EventDispatchThread.run() @bci=9, line=97 (Interpreted frame)


Thread 26: (state = IN_NATIVE)
 - sun.awt.windows.WToolkit.eventLoop() @bci=0 (Interpreted frame)
 - sun.awt.windows.WToolkit.run() @bci=49, line=299 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 25: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - sun.awt.AWTAutoShutdown.run() @bci=32, line=287 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 24: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame)
 - sun.java2d.Disposer.run() @bci=3, line=145 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 23: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - org.openide.util.RequestProcessor$Processor.run() @bci=23, line=1880 (Interpreted frame)


Thread 22: (state = IN_NATIVE)
 - java.net.DualStackPlainSocketImpl.accept0(int, java.net.InetSocketAddress[]) @bci=0 (Interpreted frame)
 - java.net.DualStackPlainSocketImpl.socketAccept(java.net.SocketImpl) @bci=37, line=121 (Interpreted frame)
 - java.net.AbstractPlainSocketImpl.accept(java.net.SocketImpl) @bci=7, line=398 (Interpreted frame)
 - java.net.PlainSocketImpl.accept(java.net.SocketImpl) @bci=35, line=183 (Interpreted frame)
 - java.net.ServerSocket.implAccept(java.net.Socket) @bci=60, line=522 (Interpreted frame)
 - java.net.ServerSocket.accept() @bci=48, line=490 (Interpreted frame)
 - org.netbeans.CLIHandler$Server.run() @bci=61, line=1042 (Interpreted frame)


Thread 20: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - org.openide.util.lookup.implspi.ActiveQueue$Impl.run() @bci=2, line=64 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=722 (Interpreted frame)


Thread 19: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.util.TimerThread.mainLoop() @bci=201, line=552 (Compiled frame)
 - java.util.TimerThread.run() @bci=1, line=505 (Interpreted frame)


Thread 14: (state = BLOCKED)


Thread 13: (state = BLOCKED)


Thread 12: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame)
 - java.lang.ref.Finalizer$FinalizerThread.run() @bci=3, line=177 (Interpreted frame)
...

Gruß Tom
 
Hallo,

Tool JSnap: Gibt einige JVM System Properties, JVM Performance Counters sowie die verwendeten JVM Flags aus.
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.JSnap 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
java.threads.started=32 event(s)
java.threads.live=21
java.threads.livePeak=25
java.threads.daemon=17
java.cls.loadedClasses=6066 event(s)
java.cls.unloadedClasses=0 event(s)
java.cls.sharedLoadedClasses=0 event(s)
java.cls.sharedUnloadedClasses=0 event(s)
java.ci.totalTime=13402222 tick(s)
java.property.java.vm.specification.version=1.7
java.property.java.vm.specification.name=Java Virtual Machine Specification
java.property.java.vm.specification.vendor=Oracle Corporation
java.property.java.vm.version=23.0-b21
java.property.java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.property.java.vm.vendor=Oracle Corporation
java.property.java.vm.info=mixed mode
java.property.java.library.path=C:\Program Files\Java\jdk1.7.0_04\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Pro
...

Gruß Tom
 
Hallo,

Tool JMap: (gleiche Ausgabe wie %JAVA_HOME%\bin\jmap)
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.JMap
Usage: jmap [option] <pid>
                (to connect to a live java process)
   or jmap [option] <executable> <core>
                (to connect to a core file)
   or jmap [option] [server_id@]<remote server IP or hostname>
                (to connect to a remote debug server)

where option must be one of:
    <no option> to print same info as Solaris pmap
    -heap       to print java heap summary
    -heap:format=b      to dump java heap in hprof binary format
    -histo      to print histogram of java object heap
    -permstat   to print permanent generation statistics
    -finalizerinfo      to print information on objects awaiting finalization
    -h | -help  to print this help message

C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.JMap -heap 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21

using thread-local object allocation.
Parallel GC with 8 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 268435456 (256.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)
   G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 65273856 (62.25MB)
   used     = 41695136 (39.763580322265625MB)
   free     = 23578720 (22.486419677734375MB)
   63.87723746548695% used
From Space:
   capacity = 5832704 (5.5625MB)
   used     = 5777120 (5.509490966796875MB)
   free     = 55584 (0.053009033203125MB)
   99.04702861657303% used
To Space:
   capacity = 9568256 (9.125MB)
   used     = 0 (0.0MB)
   free     = 9568256 (9.125MB)
   0.0% used
PS Old Generation
   capacity = 29229056 (27.875MB)
   used     = 15248400 (14.542007446289062MB)
   free     = 13980656 (13.332992553710938MB)
   52.16863657861547% used
PS Perm Generation
   capacity = 72613888 (69.25MB)
   used     = 39503336 (37.673316955566406MB)
   free     = 33110552 (31.576683044433594MB)
   54.40190174089012% used

16638 interned Strings occupying 1687656 bytes.

C:\Users\tom>

Gruß Tom
 
Hallo,

Tool HeapSummary: gibt eine kompakte Darstellung einiger Heap-Kennzahlen aus.

Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.HeapSummary 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21

using thread-local object allocation.
Parallel GC with 8 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 268435456 (256.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)
   G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 62455808 (59.5625MB)
   used     = 52892936 (50.44263458251953MB)
   free     = 9562872 (9.119865417480469MB)
   84.68857852259313% used
From Space:
   capacity = 6881280 (6.5625MB)
   used     = 6301408 (6.009490966796875MB)
   free     = 579872 (0.553009033203125MB)
   91.57319568452381% used
To Space:
   capacity = 9633792 (9.1875MB)
   used     = 0 (0.0MB)
   free     = 9633792 (9.1875MB)
   0.0% used
PS Old Generation
   capacity = 29229056 (27.875MB)
   used     = 15248400 (14.542007446289062MB)
   free     = 13980656 (13.332992553710938MB)
   52.16863657861547% used
PS Perm Generation
   capacity = 72613888 (69.25MB)
   used     = 39511984 (37.68156433105469MB)
   free     = 33101904 (31.568435668945312MB)
   54.41381130838222% used

16706 interned Strings occupying 1695152 bytes.

Gruß Tom
 
Hallo,

Tool HeapDumper: Erlaubt das erzeugen von Heap Dumps zur späteren analyse (Beispielsweise in JVisualVM)
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.HeapDumper 2996
Attaching to process ID 2996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
Dumping heap to heap.bin ...
none
null_check
null_assert
range_check
class_check
array_check
intrinsic
bimorphic
unloaded
uninitialized
unreached
unhandled
constraint
div0_check
age
predicate
loop_limit_check
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Heap dump file created


Gruß Tom
 
Hallo,

Tool FlagDumper: gibt alle JVM-Flags mit ihren aktuellen Werten aus.
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.FlagDumper 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
AdaptivePermSizeWeight = 20
AdaptiveSizeDecrementScaleFactor = 4
AdaptiveSizeMajorGCDecayTimeScale = 10
AdaptiveSizePausePolicy = 0
AdaptiveSizePolicyCollectionCostMargin = 50
AdaptiveSizePolicyInitializingSteps = 20
AdaptiveSizePolicyOutputInterval = 0
AdaptiveSizePolicyWeight = 10
AdaptiveSizeThroughPutPolicy = 0
AdaptiveTimeWeight = 25
AdjustConcurrency = false
AggressiveOpts = false
AliasLevel = 3
AllocateInstancePrefetchLines = 1
AllocatePrefetchDistance = 192
AllocatePrefetchInstr = 0
AllocatePrefetchLines = 4
AllocatePrefetchStepSize = 64
AllocatePrefetchStyle = 1
AllowInvokeGeneric = false
AllowJNIEnvProxy = false
AllowParallelDefineClass = false
AllowUserSignalHandlers = false
AlwaysActAsServerClassMachine = false
AlwaysCompileLoopMethods = false
AlwaysInflate = 0
AlwaysLockClassLoader = false
AlwaysPreTouch = false
AlwaysRestoreFPU = false
AlwaysTenure = false
AnonymousClasses = false
ArraycopyDstPrefetchDistance = 0
...


Gruß Tom
 
Hallo,

Tool FinalizerInfo: Gibt Informationen zu den aktuell in die finalizer Queue eingestellten Objekten aus:
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.FinalizerInfo 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
Number of objects pending for finalization: 0

Gruß Tom
 
Hallo,

Tool SOQL: SOQL (Simple Object Query Language) Client zum analysieren von Heap Strukturen, leider gibt es dazu (stand heute) noch nicht so viele Beispiele. Man kann sich aber grob an OQL orientieren:http://visualvm.java.net/oqlhelp.html)
Unterstützte Kommandos: select, classes, class, object, quit

Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.soql.SOQL 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
soql> classes
$Proxy1 @0x00000000ebaae9c8
$Proxy2 @0x00000000ebbb8ff8
$Proxy3 @0x00000000ebc284c0
$Proxy4 @0x00000000ebc3fc68
$Proxy5 @0x00000000ec305ad8
$Proxy6 @0x00000000ec311fd8
com.sun.beans.WeakCache @0x00000000eb56d818
com.sun.beans.finder.BeanInfoFinder @0x00000000eb576958
com.sun.beans.finder.InstanceFinder @0x00000000eb5766d8
com.sun.beans.finder.PropertyEditorFinder @0x00000000ec1da2e0
com.sun.imageio.plugins.bmp.BMPImageReaderSpi @0x00000000eb664530
com.sun.imageio.plugins.bmp.BMPImageWriterSpi @0x00000000eb6653e0
com.sun.imageio.plugins.common.InputStreamAdapter @0x00000000eb6ad690
com.sun.imageio.plugins.common.ReaderUtil @0x00000000eb6ca060
com.sun.imageio.plugins.common.SubImageInputStream @0x00000000eb6aca98
com.sun.imageio.plugins.gif.GIFImageMetadata @0x00000000ebd78f98
com.sun.imageio.plugins.gif.GIFImageReader @0x00000000ebd70a88
com.sun.imageio.plugins.gif.GIFImageReaderSpi @0x00000000eb65c538
com.sun.imageio.plugins.gif.GIFImageWriterSpi @0x00000000eb661940
com.sun.imageio.plugins.gif.GIFMetadata @0x00000000ebd75cf0
com.sun.imageio.plugins.gif.GIFStreamMetadata @0x00000000ebd76020
com.sun.imageio.plugins.jpeg.JPEG @0x00000000eb66b828
com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi @0x00000000eb669bc0
com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi @0x00000000eb66c670
com.sun.imageio.plugins.png.PNGImageDataEnumeration @0x00000000eb6aadf0
com.sun.imageio.plugins.png.PNGImageReader @0x00000000eb68c530
com.sun.imageio.plugins.png.PNGImageReaderSpi @0x00000000eb668040
com.sun.imageio.plugins.png.PNGImageWriterSpi @0x00000000eb668ea8
com.sun.imageio.plugins.png.PNGMetadata @0x00000000eb699980
com.sun.imageio.plugins.wbmp.WBMPImageReaderSpi @0x00000000eb6663e0
com.sun.imageio.plugins.wbmp.WBMPImageWriterSpi @0x00000000eb667280
...

Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.soql.SOQL 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
soql> class
usage: class <name of the class>
soql> class java.lang.String
super
        java.lang.Object
fields
        char[] value
        int offset
        int count
        int hash
        long serialVersionUID
        java.io.ObjectStreamField[] serialPersistentFields
        java.util.Comparator CASE_INSENSITIVE_ORDER
...

Es gibt wohl davon auch noch eine Variante mit JavaScript Interpreter:
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.soql.JSDB 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21
jsdb> object
sun.org.mozilla.javascript.internal.InterpretedFunction@4c5f3bf7
jsdb> object(0x0000000)
java.lang.Object@7049cca1
jsdb> object(0x0000000).hashCode()
1883884705
jsdb> object()
call to object failed!
javax.script.ScriptException: JavaException: javax.script.ScriptException: java.lang.reflect.InvocationTarget
jsdb> object(0)
java.lang.Object@7049cca1
jsdb>

Gruß Tom
 
Zurück