author | ikrylov |
Wed, 01 Dec 2010 18:26:32 -0500 | |
changeset 7405 | e6fc8d3926f8 |
parent 7397 | 5b173b4ca846 |
child 7724 | a92d706dbdd5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
1 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
1 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
23 |
* questions. |
1 | 24 |
*/ |
25 |
||
26 |
#ifndef _JAVA_JMM_H_ |
|
27 |
#define _JAVA_JMM_H_ |
|
28 |
||
29 |
/* |
|
30 |
* This is a private interface used by JDK for JVM monitoring |
|
31 |
* and management. |
|
32 |
* |
|
33 |
* Bump the version number when either of the following happens: |
|
34 |
* |
|
35 |
* 1. There is a change in functions in JmmInterface. |
|
36 |
* |
|
37 |
* 2. There is a change in the contract between VM and Java classes. |
|
38 |
*/ |
|
39 |
||
40 |
#include "jni.h" |
|
41 |
||
42 |
#ifdef __cplusplus |
|
43 |
extern "C" { |
|
44 |
#endif |
|
45 |
||
46 |
enum { |
|
47 |
JMM_VERSION_1 = 0x20010000, |
|
48 |
JMM_VERSION_1_0 = 0x20010000, |
|
49 |
JMM_VERSION_1_1 = 0x20010100, // JDK 6 |
|
50 |
JMM_VERSION_1_2 = 0x20010200, // JDK 7 |
|
51 |
JMM_VERSION = 0x20010200 |
|
52 |
}; |
|
53 |
||
54 |
typedef struct { |
|
55 |
unsigned int isLowMemoryDetectionSupported : 1; |
|
56 |
unsigned int isCompilationTimeMonitoringSupported : 1; |
|
57 |
unsigned int isThreadContentionMonitoringSupported : 1; |
|
58 |
unsigned int isCurrentThreadCpuTimeSupported : 1; |
|
59 |
unsigned int isOtherThreadCpuTimeSupported : 1; |
|
60 |
unsigned int isBootClassPathSupported : 1; |
|
61 |
unsigned int isObjectMonitorUsageSupported : 1; |
|
62 |
unsigned int isSynchronizerUsageSupported : 1; |
|
63 |
unsigned int : 24; |
|
64 |
} jmmOptionalSupport; |
|
65 |
||
66 |
typedef enum { |
|
67 |
JMM_CLASS_LOADED_COUNT = 1, /* Total number of loaded classes */ |
|
68 |
JMM_CLASS_UNLOADED_COUNT = 2, /* Total number of unloaded classes */ |
|
69 |
JMM_THREAD_TOTAL_COUNT = 3, /* Total number of threads that have been started */ |
|
70 |
JMM_THREAD_LIVE_COUNT = 4, /* Current number of live threads */ |
|
71 |
JMM_THREAD_PEAK_COUNT = 5, /* Peak number of live threads */ |
|
72 |
JMM_THREAD_DAEMON_COUNT = 6, /* Current number of daemon threads */ |
|
73 |
JMM_JVM_INIT_DONE_TIME_MS = 7, /* Time when the JVM finished initialization */ |
|
74 |
JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ |
|
75 |
JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ |
|
76 |
JMM_GC_COUNT = 10, /* Total number of collections */ |
|
77 |
||
78 |
JMM_INTERNAL_ATTRIBUTE_INDEX = 100, |
|
79 |
JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ |
|
80 |
JMM_CLASS_UNLOADED_BYTES = 102, /* Number of bytes unloaded instance classes */ |
|
81 |
JMM_TOTAL_CLASSLOAD_TIME_MS = 103, /* Accumulated VM class loader time (TraceClassLoadingTime) */ |
|
82 |
JMM_VM_GLOBAL_COUNT = 104, /* Number of VM internal flags */ |
|
83 |
JMM_SAFEPOINT_COUNT = 105, /* Total number of safepoints */ |
|
84 |
JMM_TOTAL_SAFEPOINTSYNC_TIME_MS = 106, /* Accumulated time spent getting to safepoints */ |
|
85 |
JMM_TOTAL_STOPPED_TIME_MS = 107, /* Accumulated time spent at safepoints */ |
|
86 |
JMM_TOTAL_APP_TIME_MS = 108, /* Accumulated time spent in Java application */ |
|
87 |
JMM_VM_THREAD_COUNT = 109, /* Current number of VM internal threads */ |
|
88 |
JMM_CLASS_INIT_TOTAL_COUNT = 110, /* Number of classes for which initializers were run */ |
|
89 |
JMM_CLASS_INIT_TOTAL_TIME_MS = 111, /* Accumulated time spent in class initializers */ |
|
90 |
JMM_METHOD_DATA_SIZE_BYTES = 112, /* Size of method data in memory */ |
|
91 |
JMM_CLASS_VERIFY_TOTAL_TIME_MS = 113, /* Accumulated time spent in class verifier */ |
|
92 |
JMM_SHARED_CLASS_LOADED_COUNT = 114, /* Number of shared classes loaded */ |
|
93 |
JMM_SHARED_CLASS_UNLOADED_COUNT = 115, /* Number of shared classes unloaded */ |
|
94 |
JMM_SHARED_CLASS_LOADED_BYTES = 116, /* Number of bytes loaded shared classes */ |
|
95 |
JMM_SHARED_CLASS_UNLOADED_BYTES = 117, /* Number of bytes unloaded shared classes */ |
|
96 |
||
97 |
JMM_OS_ATTRIBUTE_INDEX = 200, |
|
98 |
JMM_OS_PROCESS_ID = 201, /* Process id of the JVM */ |
|
99 |
JMM_OS_MEM_TOTAL_PHYSICAL_BYTES = 202, /* Physical memory size */ |
|
100 |
||
101 |
JMM_GC_EXT_ATTRIBUTE_INFO_SIZE = 401 /* the size of the GC specific attributes for a given GC memory manager */ |
|
102 |
} jmmLongAttribute; |
|
103 |
||
104 |
typedef enum { |
|
105 |
JMM_VERBOSE_GC = 21, |
|
106 |
JMM_VERBOSE_CLASS = 22, |
|
107 |
JMM_THREAD_CONTENTION_MONITORING = 23, |
|
108 |
JMM_THREAD_CPU_TIME = 24 |
|
109 |
} jmmBoolAttribute; |
|
110 |
||
111 |
||
112 |
enum { |
|
113 |
JMM_THREAD_STATE_FLAG_SUSPENDED = 0x00100000, |
|
114 |
JMM_THREAD_STATE_FLAG_NATIVE = 0x00400000 |
|
115 |
}; |
|
116 |
||
117 |
#define JMM_THREAD_STATE_FLAG_MASK 0xFFF00000 |
|
118 |
||
119 |
typedef enum { |
|
120 |
JMM_STAT_PEAK_THREAD_COUNT = 801, |
|
121 |
JMM_STAT_THREAD_CONTENTION_COUNT = 802, |
|
122 |
JMM_STAT_THREAD_CONTENTION_TIME = 803, |
|
123 |
JMM_STAT_THREAD_CONTENTION_STAT = 804, |
|
124 |
JMM_STAT_PEAK_POOL_USAGE = 805, |
|
125 |
JMM_STAT_GC_STAT = 806 |
|
126 |
} jmmStatisticType; |
|
127 |
||
128 |
typedef enum { |
|
129 |
JMM_USAGE_THRESHOLD_HIGH = 901, |
|
130 |
JMM_USAGE_THRESHOLD_LOW = 902, |
|
131 |
JMM_COLLECTION_USAGE_THRESHOLD_HIGH = 903, |
|
132 |
JMM_COLLECTION_USAGE_THRESHOLD_LOW = 904 |
|
133 |
} jmmThresholdType; |
|
134 |
||
135 |
/* Should match what is allowed in globals.hpp */ |
|
136 |
typedef enum { |
|
137 |
JMM_VMGLOBAL_TYPE_UNKNOWN = 0, |
|
138 |
JMM_VMGLOBAL_TYPE_JBOOLEAN = 1, |
|
139 |
JMM_VMGLOBAL_TYPE_JSTRING = 2, |
|
140 |
JMM_VMGLOBAL_TYPE_JLONG = 3 |
|
141 |
} jmmVMGlobalType; |
|
142 |
||
143 |
typedef enum { |
|
144 |
JMM_VMGLOBAL_ORIGIN_DEFAULT = 1, /* Default value */ |
|
145 |
JMM_VMGLOBAL_ORIGIN_COMMAND_LINE = 2, /* Set at command line (or JNI invocation) */ |
|
146 |
JMM_VMGLOBAL_ORIGIN_MANAGEMENT = 3, /* Set via management interface */ |
|
147 |
JMM_VMGLOBAL_ORIGIN_ENVIRON_VAR = 4, /* Set via environment variables */ |
|
148 |
JMM_VMGLOBAL_ORIGIN_CONFIG_FILE = 5, /* Set via config file (such as .hotspotrc) */ |
|
149 |
JMM_VMGLOBAL_ORIGIN_ERGONOMIC = 6, /* Set via ergonomic */ |
|
150 |
JMM_VMGLOBAL_ORIGIN_OTHER = 99 /* Set via some other mechanism */ |
|
151 |
} jmmVMGlobalOrigin; |
|
152 |
||
153 |
typedef struct { |
|
154 |
jstring name; |
|
155 |
jvalue value; |
|
156 |
jmmVMGlobalType type; /* Data type */ |
|
157 |
jmmVMGlobalOrigin origin; /* Default or non-default value */ |
|
158 |
unsigned int writeable : 1; /* dynamically writeable */ |
|
159 |
unsigned int external : 1; /* external supported interface */ |
|
160 |
unsigned int reserved : 30; |
|
161 |
void *reserved1; |
|
162 |
void *reserved2; |
|
163 |
} jmmVMGlobal; |
|
164 |
||
165 |
typedef struct { |
|
166 |
const char* name; |
|
167 |
char type; |
|
168 |
const char* description; |
|
169 |
} jmmExtAttributeInfo; |
|
170 |
||
171 |
/* Caller has to set the following fields before calling GetLastGCStat |
|
172 |
* o usage_before_gc - array of MemoryUsage objects |
|
173 |
* o usage_after_gc - array of MemoryUsage objects |
|
174 |
* o gc_ext_attribute_values_size - size of gc_ext_atttribute_values array |
|
175 |
* o gc_ext_attribtue_values - array of jvalues |
|
176 |
*/ |
|
177 |
typedef struct { |
|
178 |
jlong gc_index; /* Index of the collections */ |
|
179 |
jlong start_time; /* Start time of the GC */ |
|
180 |
jlong end_time; /* End time of the GC */ |
|
181 |
jobjectArray usage_before_gc; /* Memory usage array before GC */ |
|
182 |
jobjectArray usage_after_gc; /* Memory usage array after GC */ |
|
183 |
jint gc_ext_attribute_values_size; /* set by the caller of GetGCStat */ |
|
184 |
jvalue* gc_ext_attribute_values; /* Array of jvalue for GC extension attributes */ |
|
185 |
jint num_gc_ext_attributes; /* number of GC extension attribute values s are filled */ |
|
186 |
/* -1 indicates gc_ext_attribute_values is not big enough */ |
|
187 |
} jmmGCStat; |
|
188 |
||
189 |
typedef struct jmmInterface_1_ { |
|
190 |
void* reserved1; |
|
191 |
void* reserved2; |
|
192 |
||
193 |
jint (JNICALL *GetVersion) (JNIEnv *env); |
|
194 |
||
195 |
jint (JNICALL *GetOptionalSupport) (JNIEnv *env, |
|
196 |
jmmOptionalSupport* support_ptr); |
|
197 |
||
198 |
/* This is used by JDK 6 and earlier. |
|
199 |
* For JDK 7 and after, use GetInputArgumentArray. |
|
200 |
*/ |
|
201 |
jobject (JNICALL *GetInputArguments) (JNIEnv *env); |
|
202 |
||
203 |
jint (JNICALL *GetThreadInfo) (JNIEnv *env, |
|
204 |
jlongArray ids, |
|
205 |
jint maxDepth, |
|
206 |
jobjectArray infoArray); |
|
207 |
jobjectArray (JNICALL *GetInputArgumentArray) (JNIEnv *env); |
|
208 |
||
209 |
jobjectArray (JNICALL *GetMemoryPools) (JNIEnv* env, jobject mgr); |
|
210 |
||
211 |
jobjectArray (JNICALL *GetMemoryManagers) (JNIEnv* env, jobject pool); |
|
212 |
||
213 |
jobject (JNICALL *GetMemoryPoolUsage) (JNIEnv* env, jobject pool); |
|
214 |
jobject (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool); |
|
215 |
||
216 |
void* reserved4; |
|
217 |
||
218 |
jobject (JNICALL *GetMemoryUsage) (JNIEnv* env, jboolean heap); |
|
219 |
||
220 |
jlong (JNICALL *GetLongAttribute) (JNIEnv *env, jobject obj, jmmLongAttribute att); |
|
221 |
jboolean (JNICALL *GetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att); |
|
222 |
jboolean (JNICALL *SetBoolAttribute) (JNIEnv *env, jmmBoolAttribute att, jboolean flag); |
|
223 |
||
224 |
jint (JNICALL *GetLongAttributes) (JNIEnv *env, |
|
225 |
jobject obj, |
|
226 |
jmmLongAttribute* atts, |
|
227 |
jint count, |
|
228 |
jlong* result); |
|
229 |
||
230 |
jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env); |
|
231 |
jlong (JNICALL *GetThreadCpuTime) (JNIEnv *env, jlong thread_id); |
|
232 |
||
233 |
jobjectArray (JNICALL *GetVMGlobalNames) (JNIEnv *env); |
|
234 |
jint (JNICALL *GetVMGlobals) (JNIEnv *env, |
|
235 |
jobjectArray names, |
|
236 |
jmmVMGlobal *globals, |
|
237 |
jint count); |
|
238 |
||
239 |
jint (JNICALL *GetInternalThreadTimes) (JNIEnv *env, |
|
240 |
jobjectArray names, |
|
241 |
jlongArray times); |
|
242 |
||
243 |
jboolean (JNICALL *ResetStatistic) (JNIEnv *env, |
|
244 |
jvalue obj, |
|
245 |
jmmStatisticType type); |
|
246 |
||
247 |
void (JNICALL *SetPoolSensor) (JNIEnv *env, |
|
248 |
jobject pool, |
|
249 |
jmmThresholdType type, |
|
250 |
jobject sensor); |
|
251 |
||
252 |
jlong (JNICALL *SetPoolThreshold) (JNIEnv *env, |
|
253 |
jobject pool, |
|
254 |
jmmThresholdType type, |
|
255 |
jlong threshold); |
|
256 |
jobject (JNICALL *GetPoolCollectionUsage) (JNIEnv* env, jobject pool); |
|
257 |
||
258 |
jint (JNICALL *GetGCExtAttributeInfo) (JNIEnv *env, |
|
259 |
jobject mgr, |
|
260 |
jmmExtAttributeInfo *ext_info, |
|
261 |
jint count); |
|
262 |
void (JNICALL *GetLastGCStat) (JNIEnv *env, |
|
263 |
jobject mgr, |
|
264 |
jmmGCStat *gc_stat); |
|
265 |
jlong (JNICALL *GetThreadCpuTimeWithKind) (JNIEnv *env, |
|
266 |
jlong thread_id, |
|
267 |
jboolean user_sys_cpu_time); |
|
268 |
void* reserved5; |
|
269 |
jint (JNICALL *DumpHeap0) (JNIEnv *env, |
|
270 |
jstring outputfile, |
|
271 |
jboolean live); |
|
272 |
jobjectArray (JNICALL *FindDeadlocks) (JNIEnv *env, jboolean object_monitors_only); |
|
273 |
void (JNICALL *SetVMGlobal) (JNIEnv *env, |
|
274 |
jstring flag_name, |
|
275 |
jvalue new_value); |
|
276 |
void* reserved6; |
|
277 |
jobjectArray (JNICALL *DumpThreads) (JNIEnv *env, |
|
278 |
jlongArray ids, |
|
279 |
jboolean lockedMonitors, |
|
280 |
jboolean lockedSynchronizers); |
|
281 |
} JmmInterface; |
|
282 |
||
283 |
#ifdef __cplusplus |
|
284 |
} /* extern "C" */ |
|
285 |
#endif /* __cplusplus */ |
|
286 |
||
287 |
#endif /* !_JAVA_JMM_H_ */ |