01: /*
02: * @(#)VMInspector.java 1.4 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package sun.misc;
29:
30: public class VMInspector {
31: public static native boolean enableGC();
32:
33: public static native boolean disableGC();
34:
35: public static native boolean gcIsDisabled();
36:
37: public static native void keepAllObjectsAlive(boolean keepAlive);
38:
39: // Misc debug utility functions:
40:
41: /**
42: * Returns an object reference for the specified object address.
43: *
44: * @return an object reference which refers to the specified object
45: * address.
46: * @exception IllegalStateException if the GC is not disabled before this
47: * method is called.
48: * @exception IllegalArgumentException if the specified object address
49: * does not point to a valid object.
50: */
51: public static native Object addrToObject(long objAddr)
52: throws IllegalStateException, IllegalArgumentException;
53:
54: // Object inspection utilities:
55: public static native void dumpObject(long objAddr);
56:
57: public static native void dumpClassBlock(long cbAddr);
58:
59: public static native void dumpObjectReferences(long objAddr);
60:
61: public static native void dumpClassReferences(String classname);
62:
63: public static native void dumpClassBlocks(String classname);
64:
65: public static native void dumpHeapSimple();
66:
67: public static native void dumpHeapVerbose();
68:
69: public static native void dumpHeapStats();
70:
71: // GC utilities:
72: public static native void dumpObjectGCRoots(long objAddr);
73:
74: // Heap state capture utility:
75: public static final int SORT_NONE = 0;
76: public static final int SORT_BY_OBJ = 1;
77: public static final int SORT_BY_OBJCLASS = 2;
78:
79: public static native void captureHeapState(String name);
80:
81: public static native void releaseHeapState(int id);
82:
83: public static native void releaseAllHeapState();
84:
85: public static native void listHeapStates();
86:
87: public static native void dumpHeapState(int id, int sortKey);
88:
89: public static native void compareHeapState(int id1, int id2);
90:
91: // Class utilities:
92: public static native void listAllClasses();
93:
94: // Thread utilities:
95: public static native void listAllThreads();
96:
97: public static native void dumpStack(long eeAddr);
98: }
|