|
The Serviceability Agent(SA). The Serviceability Agent is a Sun private component in the HotSpot repository that was developed by HotSpot engineers to assist in debugging HotSpot. They then realized that SA could be used to craft serviceability tools for end users since it can expose Java objects as well as HotSpot data structures both in running processes and in core files. HotSpot SAalias clhsdb='java -classpath .:$JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB'
alias ssum="awk '{sum+=\$1}; END {print sum}'"
alias objectsizesumm="grep 'object size' | awk -F 'object size = ' '{print \$2}' | awk -F ')' '{print \$1}' | ssum"
http://javasourcecode.org/html/open-source/jdk/jdk-6u23/sun/jvm/hotspot/CLHSDB.java.html
http://rednaxelafx.iteye.com/blog/730461
https://gist.github.com/956694
Visitors: sun.jvm.hotspot.asm.InstructionVisitor
public interface InstructionVisitor {
sun.jvm.hotspot.code.CodeCacheVisitor
public interface CodeCacheVisitor {
sun.jvm.hotspot.compiler.OopMapVisitor
public interface OopMapVisitor {
sun.jvm.hotspot.debugger.cdbg.LineNumberVisitor
public interface LineNumberVisitor {
sun.jvm.hotspot.debugger.cdbg.ObjectVisitor
public interface ObjectVisitor {
sun.jvm.hotspot.debugger.cdbg.TypeVisitor
public interface TypeVisitor {
sun.jvm.hotspot.interpreter.BytecodeVisitor
public interface BytecodeVisitor {
sun.jvm.hotspot.memory.StringTable
public interface StringVisitor {
sun.jvm.hotspot.memory.SymbolTable
public interface SymbolVisitor {
sun.jvm.hotspot.memory.SystemDictionary
public static interface ClassVisitor {
public static interface ClassAndLoaderVisitor {
sun.jvm.hotspot.oops.HeapVisitor
public interface HeapVisitor {
sun.jvm.hotspot.oops.OopVisitor
public interface OopVisitor {
sun.jvm.hotspot.oops.RawHeapVisitor
public interface RawHeapVisitor extends AddressVisitor {
sun.jvm.hotspot.runtime.AddressVisitor
public interface AddressVisitor {
sun.jvm.hotspot.runtime.PerfMemory
public static interface PerfDataEntryVisitor {
sun.jvm.hotspot.utilities.soql.ObjectVisitor
public interface ObjectVisitor {
Sample: private void readSystemProperties() {
InstanceKlass systemKls = getSystemDictionary().getSystemKlass();
systemKls.iterate(new DefaultOopVisitor() {
ObjectReader objReader = new ObjectReader();
public void doOop(sun.jvm.hotspot.oops.OopField field, boolean isVMField) {
if (field.getID().getName().equals("props")) {
try {
sysProps = (Properties) objReader.readObject(field.getValue(getObj()));
} catch (Exception e) {
if (Assert.ASSERTS_ENABLED) {
e.printStackTrace();
}
}
}
}
}, false);
}
参数资料[1]. openjdk-6-src-b20-21_jun_2010.tar.gz |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||