Mit Debugger interne HotSpot JVM Informationen auslesen in Java 7

Hallo,

Tool ClassDump: Mit diesem Tool kann man wohl dynamisch erstellte Class-Definitionen die nur In-Memory vorliegen (z.Bsp. DynamicProxy Klassen) auf die Platte schreiben lassen:
Code:
C:\Users\tom>"%JAVA_HOME%\bin\java" -cp "%JAVA_HOME%\lib\sa-jdi.jar" sun.jvm.hotspot.tools.jcore.ClassDump 1104
Attaching to process ID 1104, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 23.0-b21

C:\Users\tom>dir *.class
 Datenträger in Laufwerk C: ist System
 Volumeseriennummer: 22AD-4CCA

 Verzeichnis von C:\Users\tom

01.05.2012  16:29             2.954 $Proxy1.class
01.05.2012  16:29             1.951 $Proxy2.class
01.05.2012  16:29             1.970 $Proxy3.class
01.05.2012  16:29            15.343 $Proxy4.class
01.05.2012  16:29             2.018 $Proxy5.class
01.05.2012  16:29             2.813 $Proxy6.class
               6 Datei(en),         27.049 Bytes
               0 Verzeichnis(se), 79.729.037.312 Bytes frei

Gruß Tom
 
Hallo,

mir ist gerade aufgefallen, dass in Java8B114 ein nettes Command-Line-Interface (CLI) zum HSDB enthalten ist :)
Code:
tom@gauss ~/Documents/dev/repos/labs/de.thomasdarimont.labs.java8 
$ java -cp /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
hsdb> help
Available commands:
  assert true | false
  attach pid | exec core
  buildreplayjars [ all | app | boot ]  | [ prefix ]
  detach
  dis address [length]
  disassemble address
  dumpcfg { -a | id }
  dumpcodecache
  dumpideal { -a | id }
  dumpilt { -a | id }
  dumpreplaydata { <address > | -a | <thread_id> }
  echo [ true | false ]
  examine [ address/count ] | [ address,address]
  field [ type [ name fieldtype isStatic offset address ] ]
  findpc address
  flags [ flag | -nd ]
  help [ command ]
  history
  inspect expression
...

Alle Threads auflisten:
Code:
hsdb> attach 12553
Attaching to process 12553, please wait...
hsdb> 
hsdb> 
hsdb> threads
23299 Monitor Ctrl-Break
22275 Service Thread
21763 C1 CompilerThread3
21251 C2 CompilerThread2
20739 C2 CompilerThread1
20227 C2 CompilerThread0
19715 Signal Dispatcher
14595 Finalizer
14083 Reference Handler
6403 main

Alle JVM Flags auflisten:
Code:
hsdb> flags
AbortVMOnException = null 0
AbortVMOnExceptionMessage = null 0
AdaptiveSizeDecrementScaleFactor = 4 0
AdaptiveSizeMajorGCDecayTimeScale = 10 0
AdaptiveSizePausePolicy = 0 0
AdaptiveSizePolicyCollectionCostMargin = 50 0
AdaptiveSizePolicyGCTimeLimitThreshold = 5 0
AdaptiveSizePolicyInitializingSteps = 20 0
AdaptiveSizePolicyOutputInterval = 0 0
AdaptiveSizePolicyReadyThreshold = 5 0
AdaptiveSizePolicyWeight = 10 0
AdaptiveSizeThroughPutPolicy = 0 0
AdaptiveTimeWeight = 25 0

...
Gruß Tom
 

Neue Beiträge

Zurück